On Jul 27, 2011, at 5:06 PM, AJ Ashton wrote:

> On Wed, Jul 27, 2011 at 8:49 AM, Alex Morega <[email protected]> wrote:
>> I'm rendering a simple map with country borders and labels, and have come up 
>> against a problem with placing labels: they are always placed at the 
>> polygon's center, even if that center is not within the polygon itself. For 
>> example, in [1], the label for Croatia. By contrast, Mapnik tiles for 
>> OpenStreetMap[2] seem to have much better placement. What is going on?
> 
> OpenStreetMap uses separate points for country labels, not polygons.
> They are placed manually in the approximate visual centre of the
> region. This is what I recommend doing for labels - you can derive a
> shapefile of centroid points in something like QGIS and tweak the
> placement of points that aren't quite right.

That makes sense. Thanks for the suggestion.

> There is a quick solution for just the polygons, however. Add a
> `placement="interior"` parameter to your TextSymbolizer and the label
> should always appear within the polygon. (This is only available in
> Mapnik trunk.)

It doesn't seem to do anything different from `placement="point"`, a bug 
perhaps. I do recall rendering the map a few weeks back and getting the labels 
fully confined within the polygon. Anyway, I have my workaround now.

Cheers,
-- Alex

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to