I am using mapnik and tilecache to generate tiles and openlayers to view map in the browser. In one of my shapefiles(multipolygon) with administrative boundaries, I found that more than one records have their polygons displayed in two areas in the map. In the map, label is placed in center position of the two polygons. When I opened the shapefile in Qgis, I found that label is displayed for each of the two polygons correctly. How will this type of labelling be done in mapnik. Thanks in advance.


Apparently in the current stable version of mapnik (2.2) only one of the multipolygons will be labeled. The multipolygon includes the square on the northeast and southwest quadrants of the graphic below. If you need to label all the features you might want to explode them prior to using them in mapnik.

simple vs multipolygon


That's a classical problem, they use the point of gravity for placement. That will misplace labels on multipolygons like in your case, and sometimes in elongated / "banana"-polygons.

Mapnik's TextSymbolizer had an issue, that (seems to) be resolved now.

There is an attribute called placement, where one of the value options is interior. Never tried it myself, but give it a go.

  • Hi Oyvind thank you for your suggestion.As you have suggested I tried "placement=interior" parameter in my multipolygon textsymbolizer,but the issue still exist. – user12757 Aug 23 '13 at 4:38

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.