2

I'm using Mapnik 3.0.7 to render a basemap and a Shapefile layer that contains points. The labels for these points should overlap all the layers underneath, but not each other. Unfortunately, road labels from a lower layer are preventing some of them from being placed:

labels

I've tried the following:

  • Adding allow-overlap="true" to the point TextSymbolizer, which makes the point labels overlap everything, including each other (bad).
  • Adding text-label-position-tolerance options to the underlying road labels, which I assumed would move them out of the way and allow the point labels to be placed. No effect.
  • Various text-comp-op options on the point layer and underlying layers, with no effect or undesired effects.

Is there any way to achieve this?

  • I think currently it is not possible to do what you want to do. Although you might ask the Mapnik developers at github.com/mapnik/mapnik to be sure. – nebulon42 Dec 21 '16 at 21:30
1

Turns out a proper solution is described in the Mapnik Wiki. The Layer element supports a clear-label-cache attribute:

clear-label-cache: Default "off". Setting this to "on" clears the internal placement detector list, causing the items of this layer, and from this layer on, to be rendered without taking previous rendered items into account ('clear collision avoidance list')

  • And it took me a while to figure out how to introduce this attribute in a mll file when working with cartoCSS: "properties": {"clear-label-cache": "on"}, – juminet Jul 18 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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