Relation:multipolygon/validity
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, without discarding nodes or ways (or part of ways) to build a valid geometry as define by the OGC Simple Feature standard (http://www.opengeospatial.org/standards/sfs) with the notable exception of touching inner rings on 2 or more consecutiv points.
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. A better alternative is to use solution B below, using two separate polygons. |
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: |
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). | |
E - 2 touching rings on single points
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 way #2 and way #3 endpoints share more than two ways. |
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. |
See also
- Real test cases of osm format examples with their correct representation : https://github.com/nimix/osm_conv_tests/ announce