Geos
GEOS (Geometry Engine, Open Source) is a C/C++ geometry library, developed as a port of the Java JTS Topology Suite. It implements the OGC Simple Features geometry model and is also used by, among others, QGIS, PostGIS and Shapely. In the GeoDMS, GEOS is used alongside the cgal, boost geometry and boost polygon libraries for geometric functions (functions with the geos_ prefix).
GEOS-based operators in the GeoDMS perform their calculations on double precision (float64) coordinates. The element-by-element set operations, the buffers and the simplify operators take every point type; the clean, dissolve, split, overlay, connectivity and Minkowski operators take dpoint only. Unlike the boost polygon operators, coordinates do not need to be cast to integer values first. For most polygon operations, the geos_ operators are the recommended choice, as they combine good performance with reliable results.
operators
Element-by-element set operations on two polygon data items:
- geos_intersect - element-wise intersection of two polygon arrays; also applied by the
*operator to fpoint and dpoint polygons - geos_union - element-wise union of two polygon arrays; also applied by the
+operator to fpoint and dpoint polygons - geos_difference - element-wise difference of two polygon arrays (A minus B); also applied by the
-operator to fpoint and dpoint polygons - geos_xor - element-wise symmetric difference of two polygon arrays; also applied by the
^operator to fpoint and dpoint polygons
Cleaning, dissolving and splitting:
- geos_polygon - clean and validate polygon geometry
- geos_union_polygon - dissolve all polygons into one, optionally grouped by a partition attribute
- geos_split_polygon - split multi-polygons into individual single-polygon parts, each as a separate domain entry
- geos_split_union_polygon - dissolve polygons (optionally grouped by attribute), then split into individual parts
Overlay and connectivity:
- geos_overlay_polygon - spatial overlay between two polygon datasets, producing all intersecting pairs with their intersection geometry
- geos_polygon_connectivity - find all pairs of adjacent or overlapping polygons
Buffers:
- geos_buffer - generic buffer operator that dispatches on the Composition (polygon, arc or multipoint) of its first argument
- geos_buffer_point - creates a buffer polygon around each point
- geos_buffer_multi_point - creates a buffer polygon around each coordinate of a multipoint data item
- geos_buffer_linestring - creates a buffer polygon around each arc (linestring)
- geos_buffer_multi_polygon - creates a buffer polygon for each multi polygon
Simplification:
- geos_simplify_linestring - simplify the geometry of an arc (linestring)
- geos_simplify_multi_polygon - simplify the geometry of a multi polygon
relation to the bg_, bp_ and cgal_ families
The GeoDMS offers geometric operations in five families, recognizable by the prefix of the function name:
- geos_: GEOS, double precision coordinates, recommended for most use cases
- bg_: boost geometry, floating point coordinates
- bp_: boost polygon, integer coordinates only
- cgal_: cgal, exact predicates and constructions, for cases where maximum numerical precision is required
- dms_: implemented by GeoDMS itself, for input that is not valid, see dms polygon operators
For new model configurations the geos_ operators are advised over their bg_ equivalents. See polygon operators for the operators of all families side by side.
since version
Most geos_ operators since 14.0; geos_buffer_multi_polygon since 18, geos_buffer since 20.2.0, and the ^ operator on fpoint and dpoint polygons since 20.29.0.
see also
- polygon operators - overview of all polygon operators
- GEOS - the GEOS project website
- cgal - CGAL library
- boost polygon - Boost Polygon and Boost Geometry libraries