Symbol rotation via attribute lookup

Steve Lime steve.lime at DNR.STATE.MN.US
Fri Sep 23 16:25:37 EDT 2005


A style ANGLEITEM only works with a couple symbol types hatch and circles (for drawing arcs). More
complete symbol rotation support is on the way. However, truetype labels can be rotated...

The workaround would be do something like this with a point or annotation layer:

 LABELANGLEITEM 'heading'
 CLASS
     LABEL
       TYPE TRUETYPE      
       SIZE 12
       COLOR 0 0 0       
       FONT 'adings'
     END
     TEXT 'a'
  END

With a point layer you might have to draw a single pixel (that is, add COLOR 0 0 0 to the
class object).

Steve

>>> Richard Orth - osmoGIS Incorporated <rco at OSMOGIS.COM> 09/23/05 1:48 AM >>>
Two things to try
1. Place a LABEL to display the value of 'heading'.
2. Check the attributes of the 'heading' field in PostGIS, is it a 
string, integer, float, double, etc... ANGLEITEM may need to be a 
non-string to work.

Hope this helps.

Richard C Orth

Michael Underwood wrote:

> Hello,
> I'm using PHP/MapScript 4.6 and trying to create a layer of points 
> from a PostGIS database using an arrow pointing in the direction of 
> the 'heading' field in the data table.  No matter what I try though, I 
> get a map with all of the arrows pointing straight up (i.e. 
> unrotated).  My definitions include a TrueType symbol using a 
> character of an arrow pointing up (I've also tried drawing an arrow as 
> a Vector symbol with the same results):
>
>   SYMBOL
>     NAME 'trackarrow'
>     TYPE TRUETYPE
>     FONT 'adings'
>     FILLED false
>     ANTIALIAS false
>     CHARACTER 'a'
>   END
>
> A layer with the following data source:
>
>   DATA "vessel_coordinate from (select * from archive_v where 
> vessel_id=12) as foo using unique myoid using SRID=-1"
>
> A class to size, colour and (in theory) rotate the symbol:
>
>   CLASS
>     SYMBOL 'trackarrow'
>     SIZE 12
>     STYLE
>       COLOR 0 0 0
>       ANGLEITEM 'heading'
>     END
>   END
>
> I know that the ANGLEITEM line is being read by MapServer because if I 
> change the name in quotes I get an error that the field doesn't exist, 
> and if I try putting the field name in square brackets I get parsing 
> errors, but setup like this I simply get all of the arrows size 
> twelve, coloured black, but pointing up.  The table contains thousands 
> of records with values in the heading field ranging from 0 to 359.
>
> Any insight into why the arrows won't rotate and how to make them do 
> so would be greatly appreciated.
> Thanks,
> Mike



More information about the mapserver-users mailing list