[mapserver-users] Constraining label position

Stephen Woodbridge woodbri at swoodbridge.com
Tue Feb 14 12:17:01 EST 2012


On 2/14/2012 12:03 PM, Jan Hartmann wrote:
> Hi,
>
> The development version of Openlayers has a new facility: smooth tile
> transition. When panning, the old image remains visible for 2.5 seconds
> under the new one, so as to make the panning process smoother. This
> works fine for static maps, but gives undesired effects with MapServer
> labels. Those are computed anew for every request, so e.g. labels for
> items at the corner of the map get a different position, to keep them
> inside the displayed map. This results in old and new labels being
> displayed next to one another for some time.
>
> Is there an option in MapServer to constrain the labels to always have
> the same position respective to the geometry they are labeling?

google: mapserver geomtransform

this will let you fix the label point to the centroid of the object or 
some other positions.

The issue is that the label point is generally calculated based on the 
geometry of the object as clipped to the view port. So the geometry 
changes based on the view clipping and this causes the label point to 
also change. the geomtransform works on the original data and so the 
label point becomes fixed.

There is also a lot of label enhancements being added to trunk for the 
next release. You might want to look at rfc 77 [1] in additions to rfc 
72 [2].


[1] http://mapserver.org/development/rfc/ms-rfc-77.html
[2] http://mapserver.org/development/rfc/ms-rfc-72.html

-Steve W


More information about the mapserver-users mailing list