Rotating Symbols

Stuart Eve stuarteve at LPARCHAEOLOGY.COM
Sat May 27 11:47:37 EDT 2006


Blaise

I am working with shapefiles - but am going to need to do this with all 
different types of layers (trying to abstract it out). I have just added 
the 'angle' field to the dbf to try it out and I am still getting the 
same error.

It seems that the styleObj thinks it doesn't have the member of 'angle' 
(or actualy 'angleitem') even though in my mapfile (which I 
automatically output by using $map->save) it has written it like this:

 STYLE
        ANGLE 360
        COLOR 0 0 0
        SIZE 8
        SYMBOL "rot_tri"
  END

I am now trying to go through the process of automatically creating the 
rotated symbol on the fly (but the logic of it makes my head hurt!).

Thanks for your help so far!

Stu

Blaise wrote:
> Hi Stu
> What kind of layer do you use for your symbols, point or annotation ? I assume 
> it's a shapefile (*.shp, *.shx, *.dbf) isn't it ? I don't remember exactly 
> how annotation layers work but it must be the same as point. With point 
> layers, you have to have an "angle" field (numeric, 3 digits without decimal, 
> I believe, not sure) in your dbf file, or maybe better "ANGLE" to be able to 
> set the angle. Do you have this field in the dbf and if not can you try 
> adding it ?
> And do you have the right angle instructions in the layer section of your 
> mapfile ? If not sure, post your mapfile layer section.
> Bravo for the work so far.
> Blaise
>
> Le Samedi 27 Mai 2006 16:58, Stuart Eve a écrit :
>   
>> Hi Blaise
>>
>> I have managed to get quite a long way down the road of extracting
>> points and placing them, etc.- and I think its all going to work -
>> however I have just been stumped by what seems to be to be a bug.
>>
>> I have managed to set up classes for each of the points that I wish to
>> draw - and now want to set their styles so that the symbol (a VECTOR)
>> symbol is rotated to the angle (which I have got from my geometry
>> function). However, whenever I try to access styleObj->set("angle",45)
>> it says that 'angle' doesn't exist in that object. However, I can dump
>> out the mapfile and it is there set as 360.
>>
>> Any ideas whats going on?
>>
>> Thanks
>>
>> Stu
>>
>> Blaise wrote:
>>     
>>> Stu
>>> I don't know what output you want exactly, but yes, using mapscript, you
>>> can easily put an arrow on each segment of a polyline with a loop
>>> something like :
>>> for each polyline
>>>  for each segment of polyline
>>>   get start and stop point of segment
>>>   calculate middle point of segment and angle
>>>   create new annotation arrow
>>>
>>> The geometry calculation is pretty straight forward, it's basic 2d
>>> geometry. Ask more if you need help on the mapscript functions and/or the
>>> geometry calculation.
>>> But maybe someone else on this list has got a better/different idea.
>>> Regards
>>> Blaise
>>>
>>> Le Vendredi 26 Mai 2006 16:41, vous avez écrit :
>>>       
>>>> Blaise
>>>>
>>>> Thanks for the reply. I presume that we could automatically create a
>>>> bunch of points along the line using mapscript or something - but then
>>>> how would we make sure that it was always at right angles to the line? I
>>>> guess we would have to do some fancy geometry to figure out what angle
>>>> that section of line was... sounds hard!
>>>>
>>>> Mind you it may be the only way - thanks for your help!
>>>>
>>>> Stu
>>>>
>>>> Blaise wrote:
>>>>         
>>>>> Le Vendredi 26 Mai 2006 16:23, Stuart Eve a écrit :
>>>>>           
>>>>>> Dear All,
>>>>>>
>>>>>> We have been trying to get symbols to rotate along a line in mapserver
>>>>>> (4.8.3). Basically we want to get a small triangle pointing either 45
>>>>>> degrees or 270 degrees to a line.
>>>>>>
>>>>>> We firstly tried using PIXMAPs - but I don;t think its possible to
>>>>>> rotate these at all (is that true?) plus they do not seem to follow
>>>>>> the line and always just point 'up'.
>>>>>>
>>>>>> So we then tried using some truetype symbols - these follow the line -
>>>>>> but seem to be rather erratic as to which way they point. We are using
>>>>>> a small triangle from the webdings.ttf set - and sometimes it will
>>>>>> point up and sometimes it will point down (but even if its on the same
>>>>>> section of the line).
>>>>>>
>>>>>> Does anyone have any pointers?
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>> Stu
>>>>>>             
>>>>> Hi Stu
>>>>> Well, not sure about that, but sometimes it's hard to have the symbols
>>>>> exactly where you want. Perhaps you could create a special layer (point
>>>>> or annotation) to deal with your triangles. It should then be easier to
>>>>> manipulate. Of course it's extra data, extra code, extra mapfile
>>>>> parsing and so on but you'll have your symbols where you want and well
>>>>> rotated. Regards
>>>>> Blaise
>>>>>           
>
>
>
>   


-- 
Stuart Eve
L - P : Archaeology
stuarteve at lparchaeology.com 



More information about the mapserver-users mailing list