cgal_split_union_polygon - ObjectVision/GeoDMS GitHub Wiki

Geometric functions > cgal_split_union_polygon

syntax

  • cgal_split_union_polygon(polygon_data_item)
  • cgal_split_union_polygon(polygon_data_item, partition_attribute)

description

cgal_split_union_polygon is a combination of cgal_union_polygon and cgal_split_polygon. It first dissolves polygons (optionally grouped by a partition_attribute) and then splits any resulting multi-polygons into individual single-polygon parts.

Without a partition_attribute, all polygons are unioned into one geometry first, then split into their disconnected parts.

With a partition_attribute, polygons are first grouped and dissolved per group value, and then each group's result is split into individual parts. The result includes a part_rel attribute relating each output polygon back to the partition group.

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

conditions

  1. The composition type of the polygon_data_item needs to be polygon.
  2. The order of points in the polygon_data_item needs to be clockwise for exterior bounds and counterclockwise for holes (right-hand-rule).
  3. When a partition_attribute is provided, its domain must match the domain of polygon_data_item.

result

The result is a container with:

  • geometry: polygon attribute with the individual single polygons
  • polygon_rel or part_rel: relation back to the source domain or partition

since version

14.0

example

// Union all, then split into disconnected parts
unit<uint32> parts := cgal_split_union_polygon(district/geometry)
{
    attribute<dpoint>   geometry;
    attribute<district> polygon_rel;
}

// Union by province, then split into parts per province
unit<uint32> province_parts := cgal_split_union_polygon(district/geometry, district/province_rel)
{
    attribute<dpoint>   geometry;
    attribute<province> part_rel;
}

see also

⚠️ **GitHub.com Fallback** ⚠️