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

Brent Fraser bfraser at geoanalytic.com
Wed Dec 12 08:00:54 PST 2012


Mark,

   A simple solution sounds good as long as it can fit into a strategic 
plan (I don't really have a plan for improving the polygon labeling, 
just a desire!).

     On major releases of Mapserver I try to push the limits of its 
cartography by comparing its output to hand-composed pdfs of Canadian 
Topo maps [1] (not fair I know).  One of the stumbling blocks I've run 
into is the labeling of polygons and I've speculated on the use of 
"rules-based" labeling.  Here's my list of rules from a comment on RFC 
77 [2].

     "Allow for alternate label positions.  While this is likely beyond 
the scope of RFC 77, perhaps it could be taken into account in design 
and implementation for later addition.  Basically I'd like more 
flexibility (rule-based?) in labeling polygons:

     A. Try to place label in polygon.  If it doesn't fit:
     B. Rotate label to fit inside a polygon.  If it doesn't fit:
     C. Place polygon annotation outside polygon"

I wonder if adding keywords like CHECKLABELFIT (and other new ones) is 
the way to go or use PROCESSING directives instead?

[1] 
http://geogratis.cgdi.gc.ca/geogratis/en/product/search.do?id=A6291EF5-F3FC-A29F-3162-DE4DB194FD38
[2] http://lists.osgeo.org/pipermail/mapserver-dev/2011-December/011773.html

Best Regards,
Brent Fraser

On 12/11/2012 7:33 AM, Mark Volz wrote:
> Hello,
>
> Earlier in the year I had asked about forcing labels in their polygons.   And another person mentioned the issue in September.  At the time Steve W was concerned about complexity and performance in placing labels.  I was thinking lately that maybe this topic could be revisited.  However, this time around instead of dealing with "optimal" label placement within a polygon, maybe something much simpler would be better.  For example:
>
> keyword : CHECKLABELFIT
> -FALSE: Use the BBOX for labeling.  This is the current behavior, which is fast and should remain as the default.
> -TRUE: Once the label is placed using the current label placement engine, check to make sure the BBOX of label falls within the actual boundary of the polygon, if it does not then skip the label.
>
> This keyword should not be confused with any algorithm that places labels in an optimal position within the polygon such as one that tries to place a label horizontally, then strait if it doesn't fit.  Last, since check label fit is optional, this keyword should only impact performance on layers that a user wants to verify that the label is correctly placed.  It would never be needed for a layer where the polygons are rectangular such as sections, or townships.  However it may be critical on soil layers.
>
> Just some thoughts
>
> Thanks
>
> Reference
> http://osgeo-org.1560.n6.nabble.com/force-labels-to-fit-in-polygons-td4549296.html
> http://comments.gmane.org/gmane.comp.gis.mapserver.user/49333
>
>
> Mark Volz
> GIS Specialist
>
>
> _______________________________________________
> 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