geos_polygon
Geometric functions > geos_polygon
syntax
- geos_polygon(polygon_data_item)
description
geos_polygon(polygon_data_item) results in a data item with the same domain as the polygon_data_item, with the geometry cleaned and validated using the geos library. It can be used to repair or normalize polygon geometries.
The geos_ prefix of the function name indicates that the implementation of the operator uses geos.
Only dpoint (double precision) coordinates are supported for GEOS-based polygon operations. For fpoint coordinates the operator fails with Cannot find operator for these arguments. Convert the geometry to dpoint first, for example geos_polygon(geometry[rdc_dpoint]) with a dpoint unit rdc_dpoint in the same coordinate system.
applies to
- attribute polygon_data_item with a polygon value type
conditions
- The composition type of the polygon_data_item needs to be polygon.
- The order of points in the polygon_data_item needs to be clockwise for exterior bounds and counterclockwise for holes (right-hand-rule). A feature whose rings are all reversed is read correctly anyway and comes back correctly wound. A feature that is only partly flipped still needs fix_winding_order. See Point order in polygons.
since version
14.0
example
attribute<dpoint> geometry_clean (district) := geos_polygon(district/geometry);