geos_polygon_connectivity

Geometric functions > geos_polygon_connectivity

syntax

  • geos_polygon_connectivity(polygon_data_item)
  • geos_polygon_connectivity(first_polygon_data_item, second_polygon_data_item)

description

geos_polygon_connectivity finds the pairs of polygons that overlap or touch and returns them as a new Domain unit with a relation towards each polygon of a pair. It answers the same question as geos_overlay_polygon without computing the intersection geometry: use it when only the pairing is needed, and the overlay when the geometry or the Area of each overlap is needed too.

With one argument, geos_polygon_connectivity(polygon_data_item) finds the pairs within one polygon set. 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_polygon_connectivity(first_polygon_data_item, second_polygon_data_item) finds the pairs between two polygon sets: each polygon of the first set with each polygon of the second set that it overlaps or touches.

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. The bp_polygon_connectivity, bg_polygon_connectivity and cgal_polygon_connectivity variants require a common interior point and leave the touching pairs out; to get the same pairs from geos, keep only the pairs whose geos_overlay_polygon geometry has an Area above zero. The unprefixed Polygon_connectivity pairs touching polygons too, on integer coordinates.

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

applies to

  • attribute polygon_data_item, first_polygon_data_item and second_polygon_data_item with a polygon value type with dpoint coordinates. Since GeoDMS 20 the other point types are refused with an error; convert with dpolygon first.

conditions

  1. The composition type of the arguments needs to be polygon.
  2. The Values unit of the two arguments must match.

result

The result is a new domain unit (uint32) with one entry per pair and two subitems:

  • first_rel: relation to the domain of the first (or only) argument
  • second_rel: relation to the domain of the second argument, or of the only argument in the one-argument form

A relation is absent when its argument is a Parameter (a Void domain). Note the names: the unprefixed Polygon_connectivity and box_connectivity call their relations F1 and F2.

since version

14.0

example

unit<uint32> overlap := geos_polygon_connectivity(district/geometry)
{
    attribute<district> first_rel;
    attribute<district> second_rel;
}

see also