polygon operators - ObjectVision/GeoDMS GitHub Wiki

Back to Geometric functions


  • area - calculates the surface area of each polygon
  • centroid - center of mass of each polygon
  • mid - a point in the polygon, cheaper than centroid
  • outer_single_polygon - outer ring of a single polygon (drops holes)
  • outer_multi_polygon - outer ring(s) of each multi_polygon (drops the holes)
  • geos_buffer - buffer of a (multi)polygon, geos implementation
  • canyon - street-canyon heights for road points from surrounding heights
  • centroid_or_mid - the centroid if located within the polygon, otherwise a mid-point
  • poly2grid - a grid representation of polygons
  • poly2grid_untiled - a grid representation of polygons (untiled variant)
  • poly2allgrids - a cross-table representation of polygons and raster cells
  • poly2allgrids_uint64 - a uint64 cross-table representation of polygons and raster cells
  • lower_bound - the lowest X and Y values of the points in each polygon
  • upper_bound - the highest X and Y values of the points in each polygon
  • center_bound - the center X and Y values of the points in each polygon
  • points2polygon - create polygons from sequences of points
  • sub (difference) - element-wise cutout of one polygon from another, where both domains match or one is void
  • mul (polygon intersection) - element-wise overlap of two polygon arrays, where both domains match or one is void
  • add (union) - element-wise union of two polygon arrays, where both domains match or one is void
  • box_connectivity - find connected polygons based on bounding box overlap (faster, but less precise than polygon_connectivity)

Operators based on the geos library (recommended: faster, reliable, supports float64/dpoint coordinates):

  • geos_buffer_multi_polygon - creates a buffer polygon for each multi polygon
  • geos_difference - element-wise difference of two polygon arrays (A minus B); also invoked by the - operator for fpoint/dpoint coordinates
  • geos_intersect - element-wise intersection of two polygon arrays; also invoked by the * and & operators for fpoint/dpoint coordinates
  • geos_overlay_polygon - spatial overlay between two polygon datasets, producing all intersecting pairs with their intersection geometry
  • [geos_polygon]] - clean and validate polygon geometry using [GEOS
  • geos_polygon_connectivity - find all pairs of adjacent or overlapping polygons
  • geos_simplify_multi_polygon - simplify the geometry of a multi polygon
  • 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
  • geos_union - element-wise union of two polygon arrays; also invoked by the + and | operators for fpoint/dpoint coordinates
  • geos_union_polygon - dissolve all polygons into one, optionally grouped by a partition attribute
  • geos_xor - element-wise symmetric difference of two polygon arrays; also invoked by the ^ operator for fpoint/dpoint coordinates

To be developed operators:

Operators based on the boost polygon library (usually slower than the bg_-variants, and can only process integer coordinates):

  • bp_buffer_multi_polygon - removed in 20.13.0: never implemented; use bg_buffer_multi_polygon or geos_buffer_multi_polygon
  • bp_difference - element-wise difference of two polygon arrays (integer coordinates)
  • bp_intersect - element-wise intersection of two polygon arrays (integer coordinates)
  • bp_overlay_polygon (or old syntax overlay_polygon) - spatial overlay between two polygon datasets, producing all intersecting pairs (integer coordinates)
  • bp_polygon - clean and validate polygon geometry using Boost Polygon (integer coordinates)
  • bp_polygon_connectivity (or old syntax polygon_connectivity) - find all pairs of adjacent or overlapping polygons (integer coordinates)
  • bp_split_polygon (or old syntax split_polygon) - split multi-polygons into individual single-polygon parts (integer coordinates)
  • [bp_split_union_polygon]] (or old syntax [[split_partitioned_union_polygon]]) - dissolve polygons (optionally grouped by attribute), then split into individual parts (integer coordinates). Combination of [[split_polygon]] and [partitioned_union_polygon
  • bp_union - element-wise union of two polygon arrays (integer coordinates)
  • bp_union_polygon (or old syntax union_polygon (dissolve) or partitioned_union_polygon (dissolve by attribute)) - dissolve all polygons into one, optionally grouped by a partition attribute (integer coordinates)
  • bp_polygon_filtered, bp_union_polygon_filtered, bp_split_polygon_filtered, bp_split_union_polygon_filtered - bp-set operations that drop rings smaller than the given area
  • bp_polygon_inflated, bp_union_polygon_inflated, bp_split_polygon_inflated, bp_split_union_polygon_inflated - bp-set operations after growing the polygons with the given distance
  • bp_polygon_deflated, bp_union_polygon_deflated, bp_split_polygon_deflated, bp_split_union_polygon_deflated - bp-set operations after shrinking the polygons with the given distance
  • bp kernel-suffix variants - every bp set operation also exists with a resize-kernel suffix: d/i = deflate/inflate with the given distance before the set operation, 4/8/16/X = the number of corner segments, D/HV = diagonal or horizontal-vertical corner treatment:
  • bp_polygon_d4D, bp_polygon_d8D, bp_polygon_d16D, bp_polygon_dXD, bp_polygon_d4HV, bp_polygon_dXHV, bp_polygon_i4D, bp_polygon_i8D, bp_polygon_i16D, bp_polygon_iXD, bp_polygon_i4HV, bp_polygon_iXHV - kernel-suffix variants of bp_union_polygon
  • bp_union_polygon_d4D, bp_union_polygon_d8D, bp_union_polygon_d16D, bp_union_polygon_dXD, bp_union_polygon_d4HV, bp_union_polygon_dXHV, bp_union_polygon_i4D, bp_union_polygon_i8D, bp_union_polygon_i16D, bp_union_polygon_iXD, bp_union_polygon_i4HV, bp_union_polygon_iXHV - kernel-suffix variants of bp_union_polygon
  • bp_split_polygon_d4D, bp_split_polygon_d8D, bp_split_polygon_d16D, bp_split_polygon_dXD, bp_split_polygon_d4HV, bp_split_polygon_dXHV, bp_split_polygon_i4D, bp_split_polygon_i8D, bp_split_polygon_i16D, bp_split_polygon_iXD, bp_split_polygon_i4HV, bp_split_polygon_iXHV - kernel-suffix variants of bp_split_polygon
  • bp_split_union_polygon_d4D, bp_split_union_polygon_d8D, bp_split_union_polygon_d16D, bp_split_union_polygon_dXD, bp_split_union_polygon_d4HV, bp_split_union_polygon_dXHV, bp_split_union_polygon_i4D, bp_split_union_polygon_i8D, bp_split_union_polygon_i16D, bp_split_union_polygon_iXD, bp_split_union_polygon_i4HV, bp_split_union_polygon_iXHV - kernel-suffix variants of bp_split_union_polygon
  • bp_xor - element-wise symmetric difference of two polygon arrays (integer coordinates)
  • polygon inflated - increases each polygon by expanding its boundary outward
  • polygon deflated - decreases each polygon by contracting its boundary inward

Several boost polygon functions can be combined in a single operator; for the full list of those combinations, see here.

Operators based on the boost geometry library (float64/dpoint coordinates; largely superseded by their geos equivalents):

For examples, see here.

Operators based on the cgal library:

  • cgal_difference - element-wise difference of two polygon arrays (CGAL)
  • cgal_intersect - element-wise intersection of two polygon arrays (CGAL)
  • cgal_overlay_polygon - spatial overlay between two polygon datasets, producing all intersecting pairs (CGAL)
  • cgal_polygon - clean and validate polygon geometry using CGAL
  • cgal_polygon_connectivity - find all pairs of adjacent or overlapping polygons (CGAL)
  • cgal_split_polygon - split multi-polygons into individual single-polygon parts (CGAL)
  • cgal_split_union_polygon - dissolve polygons (optionally grouped by attribute), then split into individual parts (CGAL)
  • cgal_union - element-wise union of two polygon arrays (CGAL)
  • cgal_union_polygon - dissolve all polygons into one, optionally grouped by a partition attribute (CGAL)
  • cgal_xor - element-wise symmetric difference of two polygon arrays (CGAL)