geos_overlay_polygon

Geometric functions > geos_overlay_polygon

syntax

  • geos_overlay_polygon(polygon_data_item)
  • geos_overlay_polygon(polygon_data_item1, polygon_data_item2)

description

geos_overlay_polygon computes the spatial overlay between polygon sets, resulting in a new domain containing all intersecting polygon pairs with their combined geometry.

With one argument, geos_overlay_polygon(polygon_data_item) computes a self-overlay: all pairs of polygons within the dataset that spatially overlap or touch are found and their intersection geometries are computed. Each pair occurs once, with first_rel < second_rel, and a polygon is never paired with itself. Since GeoDMS 15.7.0.

With two arguments, geos_overlay_polygon(polygon_data_item1, polygon_data_item2) computes an overlay between two polygon datasets. All pairs of polygons from the two datasets that spatially overlap or touch are found and their intersection geometries are computed.

Two polygons form a pair when their intersection is not empty: polygons with a common interior point, and also polygons that only touch, along a shared edge or at a single point. A touching pair has an empty geometry, since a line or a point is not a polygon, so its Area is zero; select on area(geometry) > 0 to keep the overlapping pairs only, which is what bp_overlay_polygon, bg_overlay_polygon and cgal_overlay_polygon find. When only the pairing is needed and not the geometry, geos_polygon_connectivity finds the same pairs as relations only.

The geos_ prefix of the function name indicates that the implementation of the operator uses geos.

applies to

  • attribute polygon_data_item1 with a polygon value type with dpoint coordinates. Since GeoDMS 20 the other point types are refused with an error; convert with dpolygon first.
  • attribute polygon_data_item2 (optional) with a polygon value type, compatible with polygon_data_item1

conditions

  1. The composition type of the arguments needs to be polygon.
  2. The value types of both arguments must be compatible (same point type).

result

The result is a container (new domain unit of type uint32) with:

  • geometry: the intersection polygon geometry for each overlapping pair
  • first_rel: relation to the domain of polygon_data_item1 (absent if domain is void)
  • second_rel: relation to the domain of polygon_data_item2 (absent if domain is void, or in 1-argument form)

since version

14.0

example

unit<uint32> overlay := geos_overlay_polygon(land_use/geometry, district/geometry)
{
    attribute<dpoint>    geometry;
    attribute<land_use>  first_rel;
    attribute<district>  second_rel;
}

see also