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.
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.
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.