cgal_overlay_polygon
Geometric functions > cgal_overlay_polygon
syntax
- cgal_overlay_polygon(polygon_data_item)
- cgal_overlay_polygon(polygon_data_item1, polygon_data_item2)
description
cgal_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, cgal_overlay_polygon(polygon_data_item) computes a self-overlay: all pairs of polygons within the dataset that spatially overlap 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, cgal_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 are found and their intersection geometries are computed.
Two polygons form a pair when their intersection has an area, that is when they have a common interior point. Polygons that only touch, along a shared edge or at a single point, are not a pair; geos_overlay_polygon differs there. When only the pairing is needed and not the geometry, cgal_polygon_connectivity finds the same pairs as relations only.
The cgal_ prefix of the function name indicates that the implementation of the operator uses CGAL, which provides exact predicates and exact constructions for maximum numerical precision.
applies to
- attribute polygon_data_item1 with a polygon value type
- attribute polygon_data_item2 (optional) with a polygon value type, compatible with polygon_data_item1
conditions
- The composition type of the arguments needs to be polygon.
- 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 pairfirst_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 := cgal_overlay_polygon(land_use/geometry, district/geometry)
{
attribute<dpoint> geometry;
attribute<land_use> first_rel;
attribute<district> second_rel;
}
see also
- cgal_polygon_connectivity - the same pairs as relations only, without the intersection geometry
- cgal_intersect - the intersection of two polygons element by element, for pairs that are already known
- geos_overlay_polygon, bg_overlay_polygon, bp_overlay_polygon - the same operator on the other geometry libraries; the geos_ one also pairs polygons that only touch
- Polygon_connectivity - the unprefixed pairing within one set of integer coordinates, touching polygons included, with relations F1 and F2
- polygon operators - the comparison of the operators that find pairs of polygons
- dms_overlay_polygon - the same operator on the sweep GeoDMS implements itself, which accepts operands that are not valid polygons
- Spatial joins and allocation - the overlay as a spatial inner join