Contents
What are the rules for polygons in PostGIS?
Rings may not self-intersect (they may neither touch nor cross one another). Rings may not touch other rings, except at a point. The last two rules are in the arbitrary category. There are other ways to define polygons that are equally self-consistent but the rules above are the ones used by the OGC SFSQL standard that PostGIS conforms to.
Are there different algorithms for geometry repair in PostGIS?
Recent versions of PostGIS include different algorithms for geometry repair: read the manual page carefully and choose the one you like best. For example, here’s a classic invalidity – the “banana polygon” – a single ring that encloses an area but bends around to touch itself, leaving a “hole” which is not actually a hole.
Why is validity so important in a polygon?
Validity is most important for polygons, which define bounded areas and require a good deal of structure. Lines are very simple and cannot be invalid, nor can points. Some of the rules of polygon validity feel obvious, and others feel arbitrary (and in fact, are arbitrary).
Is the banana polygon valid in OGC topology?
The “banana polygon” (or “inverted shell”) is a case where the OGC topology model for valid geometry and the model used internally by ESRI differ. The ESRI model considers rings that touch to be invalid, and prefers the banana form for this kind of shape.
How do you repair invalidity in a polygon?
Repairing invalidity involves stripping a polygon down to its simplest structures (rings), ensuring the rings follow the rules of validity, then building up new polygons that follow the rules of ring enclosure.
What happens when a geometry is not valid in PostgreSQL?
For geometries that are invalid, the PostgreSQL NOTICE will provide details of why it is not valid. For geometries with 3 and 4 dimensions, the validity still only tested in 2 dimensions.
Is the banana polygon a valid OGC polygon?
Running ST_MakeValid on the polygon returns a valid OGC polygon, consisting of an outer and inner ring that touch at one point. The “banana polygon” (or “inverted shell”) is a case where the OGC topology model for valid geometry and the model used internally by ESRI differ.