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

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Tue Sep 4 11:59:05 PDT 2012


Hi,

The polygons in the data are cadastrial parcels and user wants that each parcel could be identified right. GetFeatureInfo is not enough because he wants also printed maps. Therefore each parcel should have a label that is readable in some scale. That is not always easy because the size of parcels varies a lot.

Here is a reference implementation by the National Land Survey of Finland:
http://www.paikkatietoikkuna.fi/web/fi/kartta?zoomLevel=10&coord=271051.5_6947937&mapLayers=base_35+100+!default!,90+100+,99+100+&showMarker=false&forceCache=true

NLS has decided to use vertical labels with variable font size for keeping the label text usually inside their polygons. Sometimes there seems to be also leader lines. The result is rather readable but I believe that labels have at least partly set by hand.  In the NLS service the labels comes from a readily rasterised layer and they are shown only on three highest zoom levels.

Here is another place with very long and narrow parcels. The NLS labeling system does not suit here very well for web browsing because labels are often in a fixed place outside the map window.
http://www.paikkatietoikkuna.fi/web/fi/kartta?zoomLevel=10&coord=227539.5_6999494&mapLayers=base_35+100+!default!,90+100+,99+100+&showMarker=false&forceCache=true


-Jukka- 

Stephen Woodbridge wrote:

> Jukka,

> Based on your sample image you probably want something like ANGLE AUTO
on a polygon to try to compute the longest line that you can insert into
the polygon and then label along that. That would do two things, compute
an ideal label point and whatever angle you need to position the text.

> But no this does not exist in mapserver. There are a bunch of label
enhancement tickets and a lot of work has been done recently in this
area. You could add some of this thread to an appropriate ticket or open
a new one if there isn't already one.

> 6.2 also have offset labels with leaders. In this case it creates a
label and draws an arrow to point at the feature. Thomas posted some
examples to the list at some point. See:
http://mapserver.org/development/rfc/ms-rfc-81.html
  and google: mapserver offset labels rfc81

> I do have a ticket open for labeling a polygon along an interior or
exterior edge. The idea being that I want to label country borders. I
want the label to FOLLOW the border, but it needs to be offset either
inside or outside the polygon. If this were implemented then it would
work for your case if you could live with the label inside and along an
edge. But it has not been implemented yet.

-Steve W

On 9/4/2012 11:13 AM, Lime, Steve D (DNR) wrote:
> 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
>
> -----Original Message----- From:
> mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of
> Rahkonen Jukka Sent: Tuesday, September 04, 2012 9:48 AM To:
> 'Mapserver-Users (mapserver-users at lists.osgeo.org)' Subject: Re:
> [mapserver-users] Still impossible to force labels inside their
> polygons?
>
> Hi,
>
> Thank you for the answer. A little screenshot shows an example with
> two label points  inside one polygon and one polygon without a label
> point at all. Perhaps we could have more accurate polygon label
> positioning on our wish list.
>
> -Jukka Rahkonen-
>
>
> Lime, Steve D (DNR) wrote:
>
>> Aihe: RE: [mapserver-users] Still impossible to force labels
>> inside their polygons?
>>
>> Yes, still impossible. POSITION CC + MINFEATURESIZE AUTO will get
>> you close. However, MINFEATURESIZE AUTO uses bounding box checks
>> and doesn't intersect a feature geometry with its label geometry.
>>
>> Steve
>>
>> -----Original Message----- From:
>> mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
>> bounces at lists.osgeo.org] On Behalf Of Rahkonen Jukka Sent: Tuesday,
>> September 04, 2012 9:17 AM To: 'Mapserver-Users
>> (mapserver-users at lists.osgeo.org)' Subject: [mapserver-users] Still
>> impossible to force labels inside their polygons?
>>
>> Hi,
>>
>> Is the short answer by Stephen Woodbridge "No" in the tread
>> http://osgeo-
>> org.1560.n6.nabble.com/force-labels-to-fit-in-polygons-td4549296.html
>>
>>
still valid?
>>
>> I have been trying to label a polygon dataset with Mapserver 6.2
>> beta2 and some labels keep on falling outside their polygons.  By
>> the way, the thread contains an advice that does not work for me: "
>> By the way, PROCESSING "LABEL_NO_CLIP=ON" will fix the label point
>> at the polygon center. -SteveW "
>>
>> Is the solution to create a new layer with point-on-surface
>> function and label then this point layer?
>>
>> -Jukka Rahkonen- _______________________________________________
>> 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