|
From: Martin D. <md...@op...> - 2012-08-15 17:37:28
|
On Wed, Aug 15, 2012 at 9:31 AM, Andrea Aime <and...@ge...>wrote: > On Wed, Aug 15, 2012 at 4:40 PM, Rahkonen Jukka <Juk...@mm... > > wrote: > >> 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. >> > > If the spatialite algorithm works fine it's worth checking out how that is > done. Is it using OGR maybe? > There is a similar function in JTS, but now sure how well that matches a > good label point: > > http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#getInteriorPoint() > Looks to me like spatialite is using the GEOS PointOnSurface method, which is the JTS interior point algorithm. The JTS algorithm is intended just to find a point which is guaranteed to be in the interior of a polygon, so it isn't trying very hard to find a good point for labelling. However, it does try and pick a point close to the middle of the geometry if it can, so for many polygons this will be reasonable. (It would be a nice feature to provide a filter function which explicitly attempts to find a good labelling point) > > We could roll a WPS process to do that, in case people want to use it as a > starting point and then > eventually manually edit the data. > However the WPS process (chained with gs:Import to feed the data back in > the db) would create > a whole new layer, the user would have to drop the original one by hand. > Or since the JTS method is exposed as the filter function interiorPoint, would it be possible to call this as a geometry transformation in the SLD? -- > Martin Davis OpenGeo - http://opengeo.org Expert service straight from the developers. |