[mapserver-users] Still impossible to force labels inside their polygons?

Stephen Woodbridge woodbri at swoodbridge.com
Tue Sep 4 11:32:42 PDT 2012


Hi Mark,

Sure, options like this are just a matter of code. So you and Jukka 
should add to and existing ticket or create a new one as appropriate.

https://github.com/mapserver/mapserver/issues/3948

The practical issue is getting someone to make that ticket a priority. 
Patches are welcome, funding can help, etc. Talk to Thomas or other 
developers if you want to discuss funding.

This thread talked about a lot of algorithms, so if one is better than 
another for your use cases or you need support for multiple positioning 
options then you should add that to the ticket also.

-Steve W

On 9/4/2012 2:15 PM, Mark Volz wrote:
> Hello,
>
> I think many users would be able to take advantage of being able to force labels inside polygons.  At the same time I realize that the current "bounding box" algorithm is fast.   My question is could both be possible?
>
>
> Scenario One:  It would be fastest to use a bounding box to creating labels for a polygon that has a rectangular shape such as a section or township.
> LABEL
> 	....
> 	MINFEATURESIZE AUTO
> END
>
>
> Scenario Two:  Force labels to fit inside a polygon to avoiding ambiguity is more important than speed, such as a soils layer.  A ForceLabelInside (or a better keyword) will tell Mapserver to use a slower algorithm to help place the label inside the polygon.  This slower, but better placed algorithm might also be used for layers that are cached.
> LABEL
> 	....
> 	MINFEATURESIZE AUTO
> 	ForceLabeInside YES  #  Possibilities NO (current and default), YES (force label inside), ?
> END
>
>
> Thanks
>
> Mark Volz
> GIS Specialist
>
>
>
>> It's tough to know what I'm looking at from the picture. What does the layer
>> definition look like?
>>
>> At the moment polygon label point computation tries a couple of approaches
>> get a label point inside the polygon: 1) compute a center of gravity 2) if that
>> computation doesn't work (e.g. point is too close to the edge) then a
>> scanline-based process is used to sample possible positions. The mid-point of
>> the longest y sample is used.
>>
>> It's always trade-off with speed and the above seems a happy medium.
>>
>> Steve
> _______________________________________________
> 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