[mapserver-users] How to display vector symbols (direction and magnitude) in MapServer?

Daniel Morissette dmorissette at mapgears.com
Fri Aug 15 08:59:35 EDT 2008


John Maurer wrote:
> Dear MapServer Users,
> Does anybody have experience displaying vectors in MapServer? By 
> "vectors", I don't mean the usual vector vs. raster difference. What I 
> mean is displaying data like wind vectors, which are point locations 
> that have both a direction (degrees) and magnitude (e.g. meters per 
> second). Usually these are displayed as arrows, which each point in a 
> certain direction and whose tails vary in length depending on the 
> magnitude each measurement. Is this possible in MapServer? Thanks for 
> any suggestions!

You could bind the symbol size and angle to an attribute in your layer 
definition.

If you can precompute the size in pixels based on the wind speed and 
store that to an 'arrowsize' attribute then you could use a layer defn's 
like this:

LAYER
   TYPE POINT
   ...
   CLASS
     SYMBOL 'arrow'
     ANGLE [direction]
     SIZE [arrowsize]
     COLOR 0 0 0
   END
END


If you can't precompute the arrow size in pixels, then you could use 
classes based on the wind speed attribute:

LAYER
   TYPE POINT
   ...
   CLASSITEM 'windspeed'
   CLASS
     EXPRESSION ([windspeed] < 5)
     SYMBOL 'arrow'
     ANGLE [direction]
     SIZE 10
     COLOR 0 0 0
   END
   CLASS
     EXPRESSION ([windspeed] < 25)
     SYMBOL 'arrow'
     ANGLE [direction]
     SIZE 15
     COLOR 0 0 0
   END
   CLASS
     EXPRESSION ([windspeed] < 100)
     SYMBOL 'arrow'
     ANGLE [direction]
     SIZE 20
     COLOR 0 0 0
   END
   CLASS
     # No expression ... catch all for windspeed > 100
     SYMBOL 'arrow'
     ANGLE [direction]
     SIZE 25
     COLOR 0 0 0
   END
END


Daniel
-- 
Daniel Morissette
http://www.mapgears.com/


More information about the mapserver-users mailing list