[OSM-dev] (Multi)Polygon handling
jochen at remote.org
Fri Jul 13 15:13:04 BST 2012
On Fri, Jul 13, 2012 at 03:24:47PM +0200, Even Rouault wrote:
> > 3-5 not sure
> > 6) invalid
> > 7) valid
> > 8) not sure
> > 9) invalid
> > 10) valid
> > 11,12) invalid
> I think I disagree with all those ones ;-) For me, a way is a LINESTRING or a
> POLYGON with a single ring. I'd take it unmodified. And if it needs more clever
> transformations, then IMHO, the way (in the database) should be splitted into
> multiple ones that aren't degenerated.
> My perception was that the only part that need some thinking is when building a
> MULTIPOLYGON from multiple ways referenced by a relation ( bascially what is
> described in http://wiki.openstreetmap.org/wiki/Relation:multipolygon ). But I'm
> definitely not an expert on OSM specificities, so you can prove me wrong :-)
I think I agree with your here. Whether a simple polygon is valid or not that
tells us the Simple feature definition. Software that turns single ways into
single polygons should only look at one thing: If the way is closed, it is
porentially a polygon and can be converted to one. The conversion is
straightforward and easy. The software is not supposed to fix ways that might
result in invalid polygons. The result is a Simple Feature polygon and if
some application wants to check whether a polygon is valid, it can do so.
If it is valid, the way was valid, if not, then not.
The case for multipolygons is different. Here there are several ways and a
relation involved. It is much more difficult to assemble the raw data into
a multipolygon. What we want to agree on is how exactly this assembling is
done. It might be if you follow the assembling process exactly the result
is an invalid multipolygon. Thats okay.
We are not trying to make sure there aren't any invalid geometries generated.
We are trying to make sure we agree on the result of the conversion process,
may it be a valid (multi)polygon or an invalid one.
Jochen Topf jochen at remote.org http://www.remote.org/jochen/ +49-721-388298
More information about the dev