3

I'm developing map with Mapserver to be rendered in tiles and testing output with Ka-map. Most of the time labels split on two tiles are matching, but sometimes they're not.
I configured Ka-Map like

$tileWidth = 256;
$tileHeight =256;
$metaWidth = 4;
$metaHeight = 4;
/* $metaBuffer = Buffer size in pixels to add around metatiles to avoid
 * rendering issues along the edge of the map image
 */
$metaBuffer = 256;

but even large buffer of 256 pixels doesn't protect label from occasional splitting.
What good practices do exist to make sure labels are placed deterministically?

1 Answer 1

4

You can try the PARTIALS options for MapServer labels. This makes sure that labels are only drawn if they can fit completely on the generated image. It's set to TRUE by default, so try FALSE.

PARTIALS [true|false]

Can text run off the edge of the map? Default is true.

For example:

LABEL
  COLOR  150 150 150
  SIZE 6
  POSITION AUTO
  PARTIALS FALSE
END

There are several other placement options available to experiment with such as REPEATDISTANCE, MAXOVERLAPANGLE, MAXLENGTH and:

POSITION [ul|uc|ur|cl|cc|cr|ll|lc|lr|auto]

Position of the label relative to the labeling point (layers only). “Auto” placement is only available with cached labels.

The auto option for placement is only available for cached labels. To enable this option you the LABELCACHE option must be set to ON for the LAYER object - it is ON by default so you shouldn't have to add this unless yo uwant to be more explicit.

LABELCACHE [on|off]

Specifies whether labels should be drawn as the features for this layer are drawn, or whether they should be cached and drawn after all layers have been drawn. Default is on. Label overlap removal, auto placement etc... are only available when the label cache is active.

7
  • Thanks! Now tile borders are somewhat visible as labels avoiding them, but map looks much better and I can revert to minimal meta buffer.
    – alxx
    Commented Jun 1, 2011 at 12:28
  • But if deterministic placement possible, I still would be glad to hear about it, as it would distribute labels more evenly.
    – alxx
    Commented Jun 1, 2011 at 12:29
  • @alxx - check out the auto POSITION option - see updated answer Commented Jun 1, 2011 at 12:52
  • +1 I didn't know about this feature of MapServer. Thus, when caching, with TileCache, WMS layers I avoided annotation layers because the effect described in the question. Please, could you tell us since what MapServer version is this feature available?
    – dariapra
    Commented Jun 1, 2011 at 14:26
  • @dariapra The PARTIALS option has been around for at least 5 years. So v4.6? Maybe earlier. Commented Jun 1, 2011 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.