Hi Manel,

On Fri, 28 May 2010 14:21:08 +0200, <[email protected]> wrote:
> I've two problems with label placement:
> 
> 1) When the centroid is outside of the polygon the label will appear to
be
> labeling just another polygon (confusing).

Maybe the SQL extension function 'ST_PointOnSurface' can help you (at
least as a workaround), if you use PostGIS as data source. For a given
surface, this function returns a point which is guaranteed to lie on the
surface. It does not guarantee any more, but with PostGIS, for me for
convex shapes the labels appear similarly placed as when using ST_Centroid
(or mapnik's algorithm), more or less in the middle.

> 2) When a polygon is inside a bigger one, and they both have a similar
> centroid, both labels will end in the smaller polygon (really
confusing),
> and the bigger one will appear to have no label at all (more confusion).

Is this problem solvable at all, in general? What if the outer polygon is
completely covered by smaller polygons?

If this can happen, maybe a better solution would be to label the border
of the polygon, as is often done for borders between administrative
entities.

If you know which smaller polygons lie inside the bigger one, you could
subtract their area from the bigger one, and then use ST_PointOnSurface on
the result to get the point for placement of the label. This might of
course be computationally expensive ...

Hope this helps,
-- 
Holger Schöner - [email protected]
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to