[mapserver-dev] Label Position Auto change?

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Fri Feb 24 17:32:35 EST 2012


The label cache code doesn't use CC if labeling points or polygons w/styles. Probably needs tweaking given label style support. Here's the current logic:

if(layerPtr->type == MS_LAYER_POLYGON || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_POLYGON && cachePtr->numstyles == 0)) {
  positions[0]=MS_CC; positions[1]=MS_UC; positions[2]=MS_LC; positions[3]=MS_CL; positions[4]=MS_CR;
  npositions = 5;
} else if(layerPtr->type == MS_LAYER_LINE || (layerPtr->type == MS_LAYER_ANNOTATION && cachePtr->shapetype == MS_SHAPE_LINE && cachePtr->numstyles == 0)) {
  positions[0]=MS_UC; positions[1]=MS_LC; positions[2]=MS_CC;
  npositions = 3;
} else {
  positions[0]=MS_UL; positions[1]=MS_LR; positions[2]=MS_UR; positions[3]=MS_LL; positions[4]=MS_CR; positions[5]=MS_CL; positions[6]=MS_UC; positions[7]=MS_LC;
  npositions = 8;
}

There's already a ticket (http://trac.osgeo.org/mapserver/ticket/2981) although I have no immediate plans to fix it...

Steve

-----Original Message-----
From: mapserver-dev-bounces at lists.osgeo.org [mailto:mapserver-dev-bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
Sent: Friday, February 24, 2012 4:21 PM
To: mapserver-dev
Subject: [mapserver-dev] Label Position Auto change?

Hi Thomas, Steve L,

Would it be easy to change the labeling to either change the order of 
POSITION AUTO or to add a PROCESSING directive or some other mechanism 
to change the order.

For example when labeling cities, I think it would look better if we 
followed an order like:

Upper center
Lower center
Center right
Center left
Upper right
Upper left
Lower right
Lower left
Center center - this is bad if you have a symbol because it falls over 
the symbol, so I can see optionally leaving it out of the list.

Obviously, not everyone will have this preference so some flexibility in 
defining the order would make sense.

Another idea would be to do something like:

POSITION "UC LC CR CL UR UL LR LL"  # to specify the order (note no CC)

This would make it easy to pass the same via a binding.

Does anyone have any thoughts on this? Cartography, technical, other?

I will create an enhancement ticket and summarize this thread in it.

Thanks,
   -Steve W
_______________________________________________
mapserver-dev mailing list
mapserver-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-dev




More information about the mapserver-dev mailing list