dms_polygon
Geometric functions dms_polygon
syntax
- dms_polygon(polygon_data_item)
description
dms_polygon(polygon_data_item) reads each element of the argument under the even-odd rule and writes it back as a valid polygon: clockwise shells, counter-clockwise holes, no vertex on the straight line between its neighbours, and the rings ordered by their first vertex.
It is the clean-up of the dms polygon operators family, and the one that says most plainly what the family is for: the argument does not have to be a valid polygon. Rings may cross themselves, touch themselves, overlap or touch each other, or fail to close, and their orientation is not consulted. A ring shaped like a bow tie comes out as the two triangles it encloses, since the middle is crossed twice; that is the even-odd reading, and it is what the OGC definition the geometry libraries implement leaves undefined.
Geometry that is already valid comes back unchanged apart from vertices that lie on a straight line between their neighbours, which are dropped.
applies to
- Attribute polygon_data_item with a polygon Value type: spoint, ipoint, wpoint, upoint, fpoint or dpoint
conditions
The composition type of the argument needs to be polygon.
since version
20.20.0
example
attribute<ipoint> cleaned (district, polygon) := dms_polygon(district/geometry);
see also
- dms polygon operators - the family: the even-odd rule, the grid and what the result looks like
- Cleaning invalid polygons - the worked example
- geos_polygon, bp_polygon, bg_polygon, cgal_polygon - the same operator on the geometry libraries, which repair rather than reinterpret
- dms_union_polygon - the same reading, but dissolving all elements into one
- fix_winding_order, fix_polygon - repairs that keep the OGC reading of a polygon