Hi Lennard,
On Fri, 28 May 2010 15:30:29 +0200, Lennard <[email protected]> wrote:
> On 28-5-2010 14:55, numenor wrote:
>> 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.
>
> Sure, this works, but then again, as you say, only with data from
PostGIS.
>
> The other thing: don't try it with OSM data. You'll receive a very nasty
> stream of invalid geometry warnings from geos and a hefty slowdown in
> rendering while this is going on.
Do you know under which circumstances this may happen?
I am using this construct with OSM data:
CASE WHEN ST_Within(ST_Centroid(way), way) THEN ST_Centroid(way) ELSE
ST_PointOnSurface(way) END AS way
(so actually this might be the reason, why the labels usually appear in
the middle of the shape ...) since about a year, without consciously
noticing the problems you describe. On the other hand, after importing the
data using osm2pgsql I usually perform some database cleanup before actual
rendering, which is supposed to fix invalid geometries. But thanks for the
note anyway, I was not aware of that.
And, yes, my preprocessing and rendering takes a little more time than one
might usually like to spend on frequent tile generation ;-)
Yours,
--
Holger Schöner - [email protected]
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users