[ka-Map-users] Repeated labels on a polygon layer

David Badke dbadke at uvic.ca
Wed May 31 18:27:44 EDT 2006


Thanks for the explanation and suggestions. At least I know it's not my 
fault! It explains why the repeat pattern depends on zoom level; if the 
feature as rendered is small enough, it fits on a single meta-tile.

I will try the meta-tile route, and if that fails, try creating a point 
shapefile for the labels.


Paul Spencer wrote:
> David,
> this is a side-effect of creating tiles.  The issue is that mapserver 
> has no way to deterministically place labels on tiles or to retain 
> some knowledge that a label was already placed on an adjacent tile.
> We try to work around this as best as possible by rendering a 
> 'meta-tile' which is essentially a much larger map draw which is then 
> sliced into smaller tiles that are actually served to the client.  
> This just reduces the number of times the problem occurs, it doesn't 
> eliminate it.
> The only advice I have right now is to try increasing the size of the 
> meta tile that you are creating.  You do this by modifying config.php 
> and changing the metaWidth and metaHeight variables.
> You need to be careful that the number of tiles wide/high times the 
> size of each tile does not exceed mapserver's compiled-in limit for a 
> single map draw (typically 2000x2000 I think).
> Also, you need to be aware that larger map draws take more time.  If 
> you are in a position to compile mapserver and change this limit (or 
> can find someone to do it for you) and/or are willing to spend time 
> pre-generating maps, then the best-case solution right now is to jack 
> up the sizes to some large numbers and pre-generate all the tiles.
> I am not aware of any effort to help out label placement for tiled 
> viewers, nor of any decent way of addressing the problem in mapserver.
> Actually, there is one way you could do it I think, which would be to 
> pre-process all your labels into a separate point shape file with 
> attributes.  I'm not a gis guy, but I think this must be possible 
> (although you may need something commercial to do it).
> It may be more possible to write a utility for mapserver to do this by 
> walking through every layer with labels and getting each feature (and 
> the extents of the feature) and having mapserver return the location 
> that it would render the label at if the entire feature were visible, 
> then storing that location and associated text in a separate shape 
> file.  This would work for static data, but not for dynamic data 
> unfortunately.
> Perhaps something like this could be used in mapserver itself when 
> labeling?
> Cheers
> Paul
> On 31-May-06, at 3:09 PM, David Badke wrote:
>> I have a map with two polygon layers. Two other annotation layers 
>> label the polygons. This all works, except that the labels repeat - 
>> each polygon has the same label, in different places, two or more 
>> times. In some cases one of the repeated labels isn't even on the 
>> polygon, and none of the labels are where I wanted them (POSITION 
>> UL). I have tried changing the annotation layers to point or polygon 
>> layers - doesn't help. The layer data is all in shapefiles (except 
>> the base layer).
>> So is this a ka-Map problem, a MapServer problem, a data problem, my 
>> problem, or what? Anyone have any idea how to make it stop doing this?
>> You can see an example at
>> http://vihistory-dev.uvic.ca/maps/htdocs/index.php?map=vicstreet1902
>> Zoom in to 50% (the middle block in the zoom widget).

David Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada

More information about the ka-Map-users mailing list