[mapserver-users] trying new label positioning - no change

Steve Lime Steve.Lime at dnr.state.mn.us
Wed Feb 18 01:15:56 EST 2009

Comments inline...

>>>> William Kyngesburye <woklist at kyngchaos.com> 02/17/09 11:34 PM >>>
> On Feb 17, 2009, at 11:02 PM, Steve Lime wrote:
>> William: In my testing a polygon layer is definitely starting at  
>> position CC.  Any chance
>> you're using an annotation layer here? I have found an issue if  
>> that's the case. The decision
>> to using one set of positions vs another is made based on the layer  
>> type NOT the geometry
>> type. So annotation layers are treated as point layers regardless of  
>> the source geometry. As
>> the code sits now that information is lost. Wasn't an issue  
>> previously since we didn't vary
>> things. I'll file a bug on this issue.
>> Let me know if this isn't the case for you.

> Ohhhh.  I've always used annotation layers for feature annotation.   
> But, if it always treats annotation layers as point layers, why does  
> ANGLE FOLLOW work on annotation layers of line features, or gravity  
> positioning on annotation of poly features?  Or does that trigger  
> stepping out of the assumed-point default somehow?

A shapes geometry is used when deciding where to compute a label point.
In this case the we're deciding on what the acceptable position array is and
that's done when processing the cache, long after the label points original
geometry has been destroyed.

> I did notice when poking around in the source that the labelling  
> routines didn't know about the geometry of individual features.  In my  
> own early (v4.4) attempts at reordering the positions for polys  
> (before the recent changes) I added a parameter to the addlabel()  
> functions to pass the shapetype.

I think I'd just pass a shapeObj pointer to the msAddLabel() and harvest
what is necessary: type and a few indexes.

>> One work around is to ditch annotation layers for polygons. They  
>> really aren't necessary with the addition of the label priority support in 5.0.

> I'm not sure what you mean here - how does label priority invalidate  
> annotation layers?

The principle reason to use annotation layers was to control the order in
which labels are stuffed into the cache. They were especially useful with
polygons since you typically draw those first but if you want to emphasize
labels then you'd have to use annotation to make the labels show before
other stuff.

Label priorities fix that. You can give a polygon layer high priority labels
without having to resort to annotation layers later in the mapfile. The benefits
(besides working around this bug) are two-fold:

  1) performance, you only have to process the polygon features once...
  2) brevity, shorter, more concise layer definitions are good...

Certainly annotation layers are still useful but principally for things like
copyright notices or road shields.


More information about the mapserver-users mailing list