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

known issue, fixed after 20.13.0

Up to and including 20.13.0, reading a multi-polygon subtracted every inner ring from the whole polygon set instead of from the polygon that inner ring belongs to. A polygon nested inside another polygon's hole — an annex in the courtyard of a merged building block, for example — was therefore dropped. This only shows up on input that is itself a multi-polygon with holes, such as the result of an earlier union, and it cost about 0.3% of the area when uniting the partition unions of the BAG building footprints of inner-city Amsterdam (#1178). Elementary unions of single polygons were never affected.

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** ⚠️