[mapserver-users] Still impossible to force labels inside their polygons?
Stephen Woodbridge
woodbri at swoodbridge.com
Tue Sep 4 10:06:46 PDT 2012
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
>
More information about the MapServer-users
mailing list