[mapserver-dev] Re: [mapserver-users] label FOLLOW and OFFSET

Stephen Woodbridge woodbri at swoodbridge.com
Sat Jan 31 17:16:54 EST 2009


Hi Tim,

Well Thomas Bonfort is probably the guy you want to talk to about what 
code where to look at. Regarding an algorithm, you will probably want to 
compute an offset line to the original and then label that. You can NOT 
just translate the line, you must create a true offset line. Think about 
  the letter C and say you want to label an offset on the outside of the 
C, then the offset line is a larger C to the left of the original. But 
what about a segment like:
__  __
   \/

that you want to offset above the notched line? Depending on the size of 
the notch and the amount of offset the notch might disappear. An offset 
is create by rolling a ball or Radius=offset along the geometry and 
tracking the balls origin as it moves. This is a common algorithm used 
in NC-Machining and well documented. So you should be able to find some 
simple C code that you can pass a polyline and offset distance to and 
get back a new polyline.

I'm CC this to the mapserver-dev list because this is really a 
development issue.

-Steve W

Tim Norris wrote:
> Hi Steve
> 
> I would be willing to spend a little time playing with the source if you 
> could give me a good place to start . . . .
> 
> thanks
> tim
> 
> Stephen Woodbridge wrote:
>> Sorry Tim,
>>
>> OFFSET is not support with ANGLE FOLLOW
>>
>> -Steve W
>>
>> Tim Norris wrote:
>>> Hi all,
>>>
>>> I have been playing with the FOLLOW label directive. What I am trying to
>>> achieve is a label that follows the street that is also OFFSET so that
>>> the label does not land on the line for the street, but instead 'above'
>>> it. Below is the LABEL directives that I am using, but note that I have
>>> also tried using the POSITION UC as well as the OFFSET 0 -6, but both
>>> give the same results. Please see the attached JPG image, you can see
>>> that 'M PARDO' is correct but that 'JR JUNIN' is not.
>>>
>>>       LABEL
>>>         COLOR 0 0 0
>>>         OUTLINECOLOR 255 255 255
>>>         TYPE TRUETYPE
>>>         FONT ArialBold
>>>         SIZE 7
>>>         ANTIALIAS TRUE
>>>         ANGLE FOLLOW
>>>         PARTIALS FALSE
>>>         MINFEATURESIZE 40
>>>         MINDISTANCE 50
>>>         OFFSET 0 -6
>>>         BUFFER 7
>>>       END
>>>
>>> Any ideas as to why this is not working? I took a quick look in
>>> maplabel.c, but could not see anything obvious . . .
>>>
>>> thanks
>>> tim
>>>
>>> Tim Norris
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>>



More information about the mapserver-dev mailing list