cgal_union_polygon - ObjectVision/GeoDMS GitHub Wiki

Geometric functions > cgal_union_polygon

syntax

  • cgal_union_polygon(polygon_data_item)
  • cgal_union_polygon(polygon_data_item, partition_attribute)

description

cgal_union_polygon(polygon_data_item) dissolves all polygons in the polygon_data_item into a single polygon by computing the union of all elements. The result has a void domain (one geometry per configuration).

cgal_union_polygon(polygon_data_item, partition_attribute) dissolves polygons grouped by the partition_attribute. Polygons sharing the same partition value are merged together. The result has a domain derived from the values unit of the partition_attribute.

This is equivalent to a "dissolve by attribute" operation in GIS terminology.

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.

since version

14.0

example

// Dissolve all districts into one polygon
parameter<dpoint> country_geometry := cgal_union_polygon(district/geometry);

// Dissolve districts grouped by province
attribute<dpoint> province_geometry (province) := cgal_union_polygon(district/geometry, district/province_rel);

see also

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