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

Puneet Kishor punk.kish at gmail.com
Tue Sep 27 07:48:03 PDT 2011


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?




More information about the MapServer-users mailing list