[mapserver-users] Re: ANGLE FOLLOW and Label Offset (v. 5.6.6)

Brent Fraser bfraser at geoanalytic.com
Tue Jun 7 17:17:48 EDT 2011


Oh sure, make it simple...

Best Regards,
Brent Fraser


On 6/7/2011 2:45 PM, Stephen Woodbridge wrote:
> Brent, Thomas,
>
> Could we optionally allow GEOMTRANSFORM inside the LABEL and here it 
> would be only used for the label. I guess the ambiguous part might be 
> does this GEOMTRANSFORM in the label work based on the original 
> geometry or LAYER level GEOMTRANSFORM that might precedes it.
>
> This seems like the simple clean solution to me.
>
> Thoughts?
>
> -Steve W
>
> On 6/7/2011 9:55 AM, Brent Fraser wrote:
>> Thomas,
>>
>> Yes, I've been trying to come up with good map file syntax to indicate
>> labeling of the transformed geometry. Currently mapserver allows:
>> - transformed original geometry (buffer, difference)
>> - augmented original geometry (bbox, start/end, vertices)
>> - rendered label geometry (labelpoint, labelpoly)
>>
>> but it doesn't label transformed geometry, only original geometry. The
>> main problem (from a user interface perspective) is how to relate
>> transformed geometry to the label specification.
>>
>> One solution is to allow a LABEL object within a STYLE object:
>>
>> CLASS
>> NAME 'Streams'
>> STYLE
>> GEOMTRANSFORM (buffer([shape], 5))
>>
>> LABEL
>> usual label settings
>> END # Label
>> END # Style
>>
>> but that's a little strange as STYLE objects are currently allowed
>> within LABEL objects.
>>
>> Another solution is to have "named" geometry and reference it in the
>> LABEL object (and keep the existing CLASS/STYLE/LABEL structure):
>>
>> CLASS
>> NAME 'Streams'
>> STYLE
>> GEOMTRANSFORM my_label_shape = (buffer([shape], 5))
>> END # Style
>>
>> LABEL
>> usual label settings
>> GEOMETRY my_label_shape
>> END # Label
>>
>> And I'm sure there are other (and hopefully better) solutions.
>>
>> Best Regards,
>> Brent Fraser
>>
>>
>> On 6/6/2011 11:02 AM, thomas bonfort wrote:
>>> Yes, the resulting shape seems like a nice candidate for offseting
>>> labels, but the problem with buffer is you will have more difficulty
>>> in deciding what is to the left from what is to the right of the line.
>>> We'd also have to make sure that the buffer operation is not too
>>> costly on cpu cycles.
>>> Anyways, until geomtransform is not applied at the layer level, there
>>> is no way to use this method as the label does not operate on the
>>> transformed geometry.
>>>
>>> On Mon, Jun 6, 2011 at 17:30, Brent Fraser<bfraser at geoanalytic.com>
>>> wrote:
>>>> Steve,
>>>>
>>>> I think just buffering the line would apply a type of smoothing (see
>>>> attached image). Using the resulting buffer line (or perhaps doing 
>>>> some
>>>> simple line smoothing on it) for labeling would be good enough.
>>>>
>>>> Best Regards,
>>>> Brent Fraser
>>>>
>>>>
>>>> On 6/6/2011 9:04 AM, Stephen Woodbridge wrote:
>>>>> Duh! you are correct, I always forget this point until I after my
>>>>> second
>>>>> cup of coffee has kicked in :)
>>>>>
>>>>> That article looks very interesting, I have to read up on that.
>>>>>
>>>>> In a past career in computer aided design and manufacturing, we used
>>>>> the
>>>>> idea of a rolling ball offset because it modeled a milling 
>>>>> machine. The
>>>>> rolling ball offset is defined as the curve traced by the center of
>>>>> a ball
>>>>> of a given radius as you roll it along a curve. The circumference of
>>>>> the
>>>>> ball can not cross over the original curve so for tight "S" curves
>>>>> if the
>>>>> diameter of the ball is larger than the gap in the "S" then the ball
>>>>> does
>>>>> not enter the gap but floats over it. This same concept would make
>>>>> for well
>>>>> behaved and good looking labels along tight twisty paths like rivers
>>>>> and
>>>>> roads.
>>>>>
>>>>> Another idea for smoothing out curves for labeling might be to apply
>>>>> an N
>>>>> point moving average and allow that to be the label path. I don't
>>>>> think this
>>>>> has been mentioned as an option in the past.
>>>>>
>>>>> -Steve W
>>>>>
>>>>> On 6/6/2011 10:20 AM, thomas bonfort wrote:
>>>>>> There are two problems with the solution you propose:
>>>>>> - if you offset the geometry in postgis, the distance of the offset
>>>>>> will be in geographical units, i.e. it will not give correct results
>>>>>> at all scales when rendered with mapserver (what you basically 
>>>>>> want is
>>>>>> to offset the line by a number of pixels roughly equal to the 
>>>>>> size of
>>>>>> the font used for labelling)
>>>>>> - angle follow on offset line should probably be done on a
>>>>>> simplified/smoothed geometry. see
>>>>>> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.6970 .
>>>>>> Ideally someone will want the feature badly enough to fund it :)
>>>>>>
>>>>>> -- 
>>>>>> thomas
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 6, 2011 at 16:02, Stephen Woodbridge
>>>>>> <woodbri at swoodbridge.com> wrote:
>>>>>>> There was some recent discussion on the dev list about potentially
>>>>>>> using
>>>>>>> the
>>>>>>> GEOMTRANSFORM to do something like a single sided offset then
>>>>>>> using that
>>>>>>> to
>>>>>>> apply the label to. BUT I do not think that has been implemented
>>>>>>> yet in
>>>>>>> mapserver.
>>>>>>>
>>>>>>> Google for "mapserver geomtransform" also look at 
>>>>>>> "geoprocessing" for
>>>>>>> some
>>>>>>> other ideas.
>>>>>>>
>>>>>>> Anyway, you might be able to do what you want if you:
>>>>>>>
>>>>>>> 1. import your data into PostGIS
>>>>>>> 2. create offset geometry in another table
>>>>>>> 3. export that table to a shapefile
>>>>>>> 4. then label that as an annotation layer so you do not draw the
>>>>>>> geometry
>>>>>>> only the label and use the original data to draw the grometry 
>>>>>>> ie: two
>>>>>>> layers.
>>>>>>>
>>>>>>> I have not tried this, but it might solve your problem.
>>>>>>>
>>>>>>> -Steve W
>>>>>>>
>>>>>>> On 6/6/2011 9:48 AM, uvg wrote:
>>>>>>>> Thank you, Thomas.
>>>>>>>> Are there any workarounds for this problem?
>>>>>>>> Is there 'best practices' for the problem?
>>>>>>>> Maybe unvisible layer or other?
>>>>>>>> 06.06.2011, 17:35, "thomas bonfort [via OSGeo.org]"<[hidden email]
>>>>>>>> </user/SendEmail.jtp?type=node&node=6445194&i=0>>:
>>>>>>>>
>>>>>>>> The status has not changed: label follow with offset is not
>>>>>>>> supported.
>>>>>>>>
>>>>>>>> regards,
>>>>>>>> thomas
>>>>>>>>
>>>>>>>> On Mon, Jun 6, 2011 at 15:33, uvg<[hidden email]> wrote:
>>>>>>>>
>>>>>>>>> Hi all!
>>>>>>>>> Sorry for my bad English.
>>>>>>>>>
>>>>>>>>> I am trying to achieve is a label that follows the rivers that is
>>>>>>>> also
>>>>>>>>> OFFSET so that
>>>>>>>>> the label does not 'above' on the line for the river.
>>>>>>>>>
>>>>>>>>> Sample code of mapfile:
>>>>>>>>>
>>>>>>>>> LABEL
>>>>>>>>> COLOR 0 40 255
>>>>>>>>> FONT "arial-italic"
>>>>>>>>> TYPE truetype
>>>>>>>>> SIZE 7
>>>>>>>>> OFFSET 5 0
>>>>>>>>> ANGLE FOLLOW
>>>>>>>>> POSITION LC
>>>>>>>>> FORCE true
>>>>>>>>> PARTIALS FALSE
>>>>>>>>>
>>>>>>>>> END
>>>>>>>>>
>>>>>>>>> "OFFSET" does not work.
>>>>>>>>> How can I offset a label?
>>>>>>>>>
>>>>>>>>> I found a message posted for a long time:
>>>>>>>>> click here.
>>>>>>>>
>>>>>>>> View this message in context: Re: ANGLE FOLLOW and Label Offset 
>>>>>>>> (v.
>>>>>>>> 5.6.6)
>>>>>>>>
>>>>>>>>
>>>>>>>> <http://osgeo-org.1803224.n2.nabble.com/ANGLE-FOLLOW-and-Label-Offset-v-5-6-6-tp6445138p6445194.html> 
>>>>>>>>
>>>>>>>>
>>>>>>>> Sent from the Mapserver - User mailing list archive
>>>>>>>> <http://osgeo-org.1803224.n2.nabble.com/Mapserver-User-f1969211.html> 
>>>>>>>>
>>>>>>>>
>>>>>>>> at
>>>>>>>> Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> mapserver-users mailing list
>>>>>>>> mapserver-users at lists.osgeo.org
>>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>>>> _______________________________________________
>>>>>>> mapserver-users mailing list
>>>>>>> mapserver-users at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>>>>
>>>>> _______________________________________________
>>>>> mapserver-users mailing list
>>>>> mapserver-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>>
>>>> _______________________________________________
>>>> mapserver-users mailing list
>>>> mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>>
>>>>
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>



More information about the mapserver-users mailing list