box_connectivity
Geometric functions box_connectivity
syntax
- box_connectivity(lower_bound(polygon_data_item), upper_bound(polygon_data_item))
definition
box_connectivity(lower_bound(polygon_data_item), upper_bound(polygon_data_item)) results in a new uint32 Domain unit with one entry for each ‘connection’ in the polygon_data_item Argument.
A ‘connection’ is a pair of bounding boxes that overlap or touch. The polygons themselves are not looked at, so a connection is a candidate pair, not a proof that the two polygons meet: Polygon_connectivity and the xxx_polygon_connectivity operators test the geometry, at a higher cost.
Since GeoDMS 20.23.1 boxes that meet only along an edge or at a corner are connected too, as the definition above says (#1291). For float coordinates a box is closed, so such boxes have that edge or corner in common. For integer coordinates a box is half-open, it runs up to but not including its upper bound, so such boxes are adjacent: the upper bound of one is the lower bound of the other. Before, only boxes that had an interior in common were reported: polygons that tile, such as grid cells or parcels made from a raster, had no connection with any of their neighbours, and Connected_parts over the result made each of them a part of its own. Such a configuration now gets more connections and fewer, larger parts; a 10 by 10 grid of squares gets 342 connections where it got none.
description
The function results in an F1 and F2 Attribute with relations to the Domain unit of the polygon_data_item attribute.
The relations indicate which connections exist, each connection only occurs once (a connection between polygon 0 and 1 only occurs as F1: 0 and F2: 1 and not vice versa). The connections are ordered on F1 and, within one F1, on F2.
Since GeoDMS 20.23.1 that order holds within one F1 as well (#1289). Before, the F2 values of one F1 came in the order in which the spatial index found the boxes, which followed from how that index was built; the set of connections was the same.
This could be very useful to speed up partitioned unions, where the result of this operator can serve as the approximate partition.
see example
unit<uint32> SomePolygonSet
{
attribute<fpoint> geometry (poly);
unit<uint32> BoxedConnectivity := box_connectivity(lower_bound(geometry), upper_bound(geometry));
unit<uint32> ConnectParts := connected_parts(BoxedConnectivity/F1, BoxedConnectivity/F2);
}
unit<uint32> SplitUnionedSet := bp_split_union_polygon(SomePolygonSet/geometry[rdc_cm], SomePolygonSet/ConnectParts/Part_rel);
conditions
- The composition type type of the polygon_data_item Argument needs to be polygon with an ipoint, spoint, fpoint, or dpoint Value type.
- The order of the points in polygon_data_item needs to be clockwise for exterior bounds and counter clockwise for holes in polygons (right-hand-rule).
since version
15.6.0
example
unit<uint32> connection := box_connectivity(lower_bound(district/geometry), upper_bound(district/geometry));
see also
- Polygon_connectivity - the exact version: pairs of polygons that overlap or touch, with the same F1 and F2 layout
- bp_polygon_connectivity, bg_polygon_connectivity, cgal_polygon_connectivity, geos_polygon_connectivity - exact pairing within one set or between two sets, as relations first_rel and second_rel
- bp_overlay_polygon, bg_overlay_polygon, cgal_overlay_polygon, geos_overlay_polygon - exact pairing with the intersection geometry of each pair
- dms_polygon_connectivity and dms_overlay_polygon - the same two, on the sweep GeoDMS implements itself, which does not require valid operands
- polygon operators - the comparison of the operators that find pairs of polygons
- configuration example: Border polygons