[mapserver-users] Re: Re: force labels to fit in polygons
Mark Volz
MarkVolz at co.lyon.mn.us
Tue Mar 6 06:42:48 PST 2012
Steve and Patricio,
Thank you for your response. I went with Patricio's idea of labeling off a point. Which should be alright unless a user is zoomed in close and cannot see the center of a polygon.
Mark Volz
GIS Specialist
Message: 2
Date: Mon, 05 Mar 2012 16:50:42 -0500
From: Stephen Woodbridge <woodbri at swoodbridge.com>
Subject: Re: [mapserver-users] force labels to fit in polygons
To: mapserver-users at lists.osgeo.org
Message-ID: <4F553532.2060708 at swoodbridge.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 3/5/2012 4:44 PM, Mark Volz wrote:
> Hello,
> Is there a way to force labels to fit inside of a polygon, even if a
> polygon is irregularly shaped? I noticed that with POSITION AUTO
> labels are falling outside of my soils boundary.
The short answer is no. It is an interesting problem, but it does not have a guaranteed result as the label might be too big to fit regardless. I am not even sure of the algorithm should be for something like this. There are a lot of parameters like:
font
font size
wrapping the text
changing the angle
finding the longest line, arc or smooth polyline that fits withing the polygon and then have the text follow that line
These are all computationally expensive to do on the fly while rendering. Ideally these should be worked out in advance then you can supply the attributes to the label via binding columns in the data.
-SteveW
More information about the MapServer-users
mailing list