geos_polygon_connectivity - ObjectVision/GeoDMS GitHub Wiki
Geometric functions > geos_polygon_connectivity
- geos_polygon_connectivity(polygon_data_item)
- geos_polygon_connectivity(first_polygon_data_item, second_polygon_data_item)
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.
- 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.
- The composition type of the arguments needs to be polygon.
- The values unit of the two arguments must match.
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.
14.0
The work is spread over the threads by the polygons of the first argument, so put the argument with the most, and the smallest, polygons first; see Which argument first under polygon operators.
unit<uint32> overlap := geos_polygon_connectivity(district/geometry)
{
attribute<district> first_rel;
attribute<district> second_rel;
}
- geos_overlay_polygon - the same pairs, with the intersection geometry of each pair
- polygon_connectivity - the unprefixed operator, for integer coordinates: also pairs touching polygons, and its relations are named F1 and F2
- box_connectivity - the cheap approximation on bounding boxes
- bg_polygon_connectivity, cgal_polygon_connectivity, bp_polygon_connectivity - the same operator on the other geometry libraries, which leave the touching pairs out
- polygon operators - the comparison of the operators that find pairs of polygons
- dms_polygon_connectivity - the same operator on the sweep GeoDMS implements itself, which accepts operands that are not valid polygons