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
  • 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):

*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 geos_ variants):

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)