[mapserver-users] arrow head doesn't draw at the end

thomas bonfort thomas.bonfort at gmail.com
Wed Sep 28 06:15:38 PDT 2011


On Wed, Sep 28, 2011 at 15:09, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:
> Hi luis,
>
> Thanks for helping out. I will try OVERLAYSYMBOL, but from the docs it seems it is no different that using two stacked symbols. I did try GAP, but that doesn't help at all.
>
> As I mentioned below, I am drawing these points, not unlike the recent thread started by Brent on drawing wind barbs. Except, in my case, these are GPS sensor readings. The reading values are always 0 or more (actually, they are close to 0, but let's say, the really tiny ones are identifiable). The readings have two values... rate and azimuth.
>
> The length of the arrows has to be drawn proportional to the rate, and arrows have to be pointed toward the azimuth.
>
> First, I don't want arrows on the 0 (or, close to 0) readings but I still want to show them. So, I've decided I will just select them out and draw them as a separate layer with just dots. Easy.
>
> Now, the ones that are to be drawn with an arrow: the problem I am facing is that I want the arrow head at the end of the arrow stem that is of a non-predictable length. Even though the docs imply that I can achieve this with GEOMTRANSFORM, I have failed to do so. And, of course, just now I learned that perhaps that could be because GEOMSTRANSFORM applies *only* to LINE layers.

The docs have *never* implied that, even if you might have wanted them to.
"end: produces the last point of the geometry": the last point of a
point geometry is the point itself, which is what is happening.


>
> Seems to me the *only* reasonable way to achieve this would be to have a GEOMTRANSFORM kind of capability for POINT layers as well, so that the last (or first or whatever... the specified) point of the symbol geometry could be decorated with another symbol.

again, geomtransform applies to the underlying feature, not the symbol
you are rendering on top of the feature. geomtransform will not help
in your case.

as paul suggested, you need to classify your data with a different
symbol depending on your [rate], and use the azimuth for the
orientation.

>
> I am open to all kinds of suggestions at this point.
>
>
> On Sep 28, 2011, at 3:04 AM, luis peinado wrote:
>
>> Hi, just trying to help.
>> I used some trick with arrows than maybe can help you with some variation.
>> I use mapserver-5.X and the way it worked for me was a LINE type layer using
>> a normal class (continous line) with an OVERLAYSYMBOL, using  a ">"
>> character.
>> Maybe changin some parameters like GAP may be useful to you.
>>
>> This is my class on a TYPE LINE layer
>> CLASS
>> NAME "capa_tub"
>> SYMBOL "continous"
>> SIZE 2
>> COLOR 6 79 167
>> OVERLAYSYMBOL "arrow"
>> OVERLAYSIZE 30
>> OVERLAYCOLOR 6 79 167
>> END
>>
>> And my continous and arrow are
>>
>> SYMBOL
>>  NAME "arrow"
>>  TYPE TRUETYPE
>>  FONT arial
>>  CHARACTER '>'
>>  FILLED true
>>  ANTIALIAS true
>>  GAP -100
>> END
>>
>> SYMBOL
>> NAME "continous"
>> TYPE ELLIPSE
>> POINTS 1 1 END
>> END
>>
>> Hope it helps.
>> Lluís
>>
>> 2011/9/27 Puneet Kishor <punk.kish at gmail.com>
>>
>>>
>>> On Sep 27, 2011, at 2:18 AM, Havard Tveite wrote:
>>>
>>>> Have you seen:
>>>>
>>>>
>>> http://mapserver.org/mapfile/symbology/construction.html#changing-the-center-of-a-point-symbol
>>>
>>>
>>> Yup, seen and read it from end to end until my eyes glazed. Perhaps it is
>>> clear as crystal to the rest of the world, but I can't fathom anything there
>>> applicable to me. I am facing four problems --
>>>
>>> 1. As I mentioned below, per the docs, I am supposed to be able to declare
>>> "ANGLE AUTO" in my STYLE definition. That simply does not work for me. I
>>> *have* to declare the angle the same as the angle of the stem of the arrow
>>> "ANGLE [az]" in order to get arrow heads headed in the same direction as the
>>> arrow stems.
>>>
>>> 2. From the docs on GEOMTRANSFORM, "end: produces the last point of the
>>> geometry. When used with ANGLE AUTO, it can for instance be used to render
>>> an arrowhead." Well, no... it is *not* producing the *last point of the
>>> geometry* as I understand it. Instead, it is producing the middle point of
>>> the geometry. And it sure as as I can see is not working with ANGLE AUTO
>>> (see #1 above).
>>>
>>> 3. I have tried several variations on my arrow head to try shift its
>>> center, but I am failing to translate the information in the above document
>>> to be able to do it correctly.
>>>
>>> 4. Perhaps most important: the length of the arrow is varying based on
>>> [rate]. In other words, I want only the stem to be shorter or longer, but
>>> the arrow head to be the same size, and to be at the "end" of the stem
>>> always. In fact, there are instances in which [rate] could be equal to zero.
>>> In those instances I don't want any arrow to be drawn at all.
>>>
>>> *** In other words, I want an arrow stem to be as long as the varying
>>> [rate], and if the stem has a length greater than zero then and only then do
>>> I want an arrow head at the end of the stem pointing in the same direction
>>> as the stem. ***
>>>
>>> I even tried using a truetype font symbol, but I get no image at all but no
>>> error as well.
>>>
>>> I even tried using a SYMBOL of TYPE pixmap pointing to an image of an
>>> arrow. I realize that if I could make that work, it would still be
>>> unsatisfactory because as MapServer would scale my arrow image, it would
>>> make the attached arrow head also larger, and that would look ugly. In any
>>> case, I couldn't get that to work as well... no image at all, but no error
>>> as well.
>>>
>>> Could be my compilation of MapServer was buggy, but I didn't see any
>>> compilation time errors, and other than the above oddities, it works quite
>>> well.
>>>
>>> $./mapserv -v
>>> MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ
>>> SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER
>>> SUPPORTS=WMS_CLIENT SUPPORTS=GEOS INPUT=POSTGIS INPUT=GDAL INPUT=SHAPEFILE
>>>
>>> I would love to know if my *** objective *** above can be accomplished with
>>> MapServer. If not, I would look at other workaround. I am currently
>>> rendering arrows using OpenLayers vector layer... it works quite well, but
>>> is slow... MapServer is much faster, and could be cached, hence my desire to
>>> use MapServer.
>>>
>>> Thanks.
>>>
>>>
>>>>
>>>> Håvard Tveite
>>>>
>>>> On 9/27/2011 4:12 AM, Puneet Kishor wrote:
>>>>> My arrows look like so -->-- instead of ---->  with declarations like so
>>>>>
>>>>>    SYMBOL
>>>>>        NAME "vert-line"
>>>>>        TYPE vector
>>>>>        POINTS
>>>>>            0 1
>>>>>            0 0
>>>>>        END
>>>>>    END
>>>>>
>>>>>     SYMBOL
>>>>>        NAME "up"
>>>>>        TYPE vector
>>>>>        POINTS
>>>>>            0 1
>>>>>            0.5 0
>>>>>            1 1
>>>>>        END
>>>>>    END
>>>>>
>>>>>    CLASS
>>>>>        STYLE
>>>>>            SYMBOL 'vert-line'
>>>>>            ANGLE [az]
>>>>>            SIZE [rate]
>>>>>            COLOR 0 0 0
>>>>>            WIDTH 1
>>>>>        END
>>>>>        STYLE
>>>>>            SYMBOL "up"
>>>>>            ANGLE [az]
>>>>>            SIZE 5
>>>>>            GEOMTRANSFORM "end"
>>>>>            COLOR 0 0 0
>>>>>        END
>>>>>    END
>>>>>
>>>>> But, at least the arrow heads are aligned correctly. Because, if I use
>>> "ANGLE auto" as prescribed in the docs instead of "ANGLE [az]" as shown
>>> above, my arrows draw like so --^--. The heads are always pointed up, and
>>> are in the middle.
>>>>>
>>>>> Suggestions?
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>>
>>
>> --
>>
>> *Lluís Peinado*
>>
>> ***Geodata Sistemas,SL.*
>>
>> luis.peinado at geodata.es
>>
>>
>>
>> T. 933 035 367 (ext. 21)
>>
>> F. 933 080 071
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>



More information about the MapServer-users mailing list