This page is only a proposition, it doesn't represent a consenus of what is or isn't valid, but only what could and couldn't be considered valid
General Rule for validity : A multipolygon relation in OSM is considered valid if it can be used to build a valid geometry as define by the OGC Simple Feature standard (http://www.opengeospatial.org/standards/sfs) without:
- discarding nodes or ways (or part of ways) with the notable exception of touching inner rings on 2 or more consecutive points,
- splitting ways and rearranging them to another ring structure.
Notable exception: touching inner rings on 2 or more consecutiv points.
One should be aware that OGC distinguishes between polygon and multipolygon, the latter being a collection of polygons. Building a valid OGC-geometry from an OSM-multipolygon therefore means that each outer boundary with its corresponding inner boundaries should build a valid OGC-polygon.
This means that the (implicit) polygons as part of a OSM-MP should conform to these rules as defined in the Geometry object model (Simple Feature Access - Part 1: Common Architecture):
- a) Polygons are topologically closed;
- b) The boundary of a Polygon consists of a set of LinearRings that make up its exterior and interior boundaries;
- c) No two Rings in the boundary cross and the Rings in the boundary of a Polygon may intersect at a Point but only as a tangent, e.g. ∀ P ∈ Polygon, ∀ c1,c2∈P.Boundary(), c1≠c2, ∀ p, q ∈Point, p, q ∈ c1, p ≠ q , [p ∈ c2] ⇒ [∃ δ > 0 ∋ [|p-q|<δ] ⇒ [q ∉ c2] ]; Note: This last condition says that at a point common to the two curves, nearby points cannot be common. This forces each common point to be a point of tangency.
- d) A Polygon may not have cut lines, spikes or punctures e.g.: ∀ P ∈ Polygon, P = P.Interior.Closure;
- e) The interior of every Polygon is a connected point set;
- f) The exterior of a Polygon with 1 or more holes is not connected. Each hole defines a connected component of the exterior.
Valid multipolygon relations
- A few more are here : Relation:multipolygon
A - Multipolygon in "8" shape with point at intersection
However, it is highly recommended to avoid situations where the inner and outer side change between left to right side when following the way. This ABCDEFA shape should preferably drawn as
so that no part of the boundary line will pass through both sides of another part of the boundary line at the intersection node B
B - Multipolygon made of two ways touching in a middle point
|This is the recommanded representation, using two simple closed ways intersecting only on one node.|
This second example, touching on the middle of ways should preferably be avoided because it cannot be converted to a valid OGC-multiploygon:
C - A inner ring touching the outer ring on a single point
|Alternatively, this may be drawn as a single polygon ABCDEFDA, where the polygon pass twice through the same point D (as in the second example below).
|However there is a problem using a single closed ring like ABCDFEGDHA in this example: if the boundary is morphed by moving F onto the line BC the result is NOT a valid OGC-polygon, because the interior is no longer connected. If editing is done in a box including points E, F and B only (not including any of the other points), the mapper will not be aware of that problem.|
|You may also split this single way in two parts on point D to create a multipolygon: way DCBAGD will be an outer member of the multipolygon, and way DEFD will be an inner member as in the first figure.|
E - 2 touching rings on single points
|These two ways that are outer members of the multipolygon may also be replaced by two other ways: one larger outer way ignoring the borders of the central hole, and an inner way passing along these borders, where both ways pass through the same two isolated nodes.|
Invalid multipolygon relations
1 - Unclosed polygons
|This is an example of an invalid multipolygon because unclosed.|
2 - Overlapping, unclosed member ways belonging to the same role
|This is an example of an invalid multipolygon, as the startpoint or endpoint of way #2 and way #3 actually share an odd number (three) of ways (ways #1, #2 and #3 for one point, or ways #2, #3 and #4 for the second point).|
3 - Self intersection without point
|You must explicitly add the missing intersection node, then you should preferably split the shape into two separate closed polygons touching on that point (ideally the two rings directions could be identical, both clockwise or anticlockwise but this is not required)|
4 - 2 Overlapping outer-ring
Generally this is an error caused by lack of precision where one polygon should touch another polygon on the same segments.
5 - Polygon sharing a way with itself
The arbitrary segment used twice in reverse directions (DE then ED) should be splitted, leaving two overlapping segments.
6 - „Forest with lake with forest on island in lake“
|The interior (green) is not connected, so this violates OGC rule e))|