[Geoserver-users] polygon label repeated for each tile

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-

On Wed, Aug 15, 2012 at 4:40 PM, Rahkonen Jukka <Jukka.Rahkonen@anonymised.com> 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()

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.

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.

Hmm… the metatatiles are actually not oversized afaik, the previous mail stated “oversized tiles” which I believe means metatiles.

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.

Yes, it can

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Wed, Aug 15, 2012 at 9:31 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Wed, Aug 15, 2012 at 4:40 PM, Rahkonen Jukka <Jukka.Rahkonen@anonymised.com> 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.

On Wed, Aug 15, 2012 at 10:37 AM, Martin Davis <mdavis@anonymised.com> wrote:

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?

Or the existing Transform process can be used to call the interiorPoint function from CQL, avoiding the need to make a new process.

Martin Davis
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Martin Davis
OpenGeo - http://opengeo.org
Expert service straight from the developers.

On Wed, Aug 15, 2012 at 7:37 PM, Martin Davis <mdavis@anonymised.com> wrote:

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?

Yes

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On Wed, Aug 15, 2012 at 7:42 PM, Martin Davis <mdavis@anonymised.com> wrote:

Or the existing Transform process can be used to call the interiorPoint function from CQL, avoiding the need to make a new process.

Indeed, too

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


Hiya,

Thanks for reminding me about the interiorPoint funtion. I actually used this in a recent project, because I didn’t want to add an extra geometry column to the PostGIS table and was okay with GeoServer computing the anchor point on the fly, like so:

**** **** **the_polygon_geometry_column** **** **** ...

Regards,

Edward


Date: Wed, 15 Aug 2012 21:37:33 +0200
From: andrea.aime@anonymised.com
To: mdavis@anonymised.com
CC: Jukka.Rahkonen@anonymised.com86…; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] polygon label repeated for each tile

On Wed, Aug 15, 2012 at 7:37 PM, Martin Davis <mdavis@anonymised.com> wrote:

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?

Yes

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today’s security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users

On Wed, Aug 15, 2012 at 10:20 PM, Edward Mac Gillavry <emacgillavry@anonymised.com> wrote:

Hiya,

Thanks for reminding me about the interiorPoint funtion. I actually used this in a recent project, because I didn’t want to add an extra geometry column to the PostGIS table and was okay with GeoServer computing the anchor point on the fly, like so:

**** **** **the_polygon_geometry_column** **** **** ...

Doh, and I though it was still not exposed! :slight_smile:
/me blushes

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it