Andrea Aime wrote:
There is this common fallacy that the centroid is a good label point, while try in
most simple cases there is no guarantee it actually falls inside the polygon
(think of a doughnut), a label point instead should always be inside or at worse
on the border (which is something the labeler in its default configuration guarantees instead)
I made a quick test with 22339 rather complicated polygons and PointOnSurface function in Spatialite. Result looks pretty good with all the points well inside their polygons which was a nice surprise. I was remembering from the past that point on surface is not usable for labeling because when I last tried the same function with Oracle it simply placed the points on surface into the first outer ring vertices. Perhaps Oracle does it in a more clever way nowadays. Somehow I feel that PostGIS behaves a lot like Spatialite.
I feel that point on surface could be a reasonable candidate for label anchor point. Problem with Geoserver is that all backends would not behave in a similar way. It could perhaps be possible to a sort of a simulation by creating a point layer with PointOnSurface and use that for labeling. Perhaps it does not tell anything about how well partial labels from adjacent tiles match.
Those who use tiles can motivate themselves to coding by thinking that if the system is able to match partial labels there would be no need for creating oversized metatiles. This could mean less pixels to create when seeding the cache and thus more speed.
By the way, can Geoserver utilize several geometry columns in one table in Oracle, PostGIS and Spatialite? If yes, users could pre-process the data and create label points into their own geometry fields, as well as simplified geometries to be used at small scales. It would not make database much bigger because there would be no need to copy the attributes.
-Jukka Rahkonen-