bg_union_polygon - ObjectVision/GeoDMS GitHub Wiki

Geometric functions bg_union_polygon

DO NOT USE: current implementation does not produce reliable results

Use geos_union_polygon instead; it is the recommended default for polygon set operations.

Boost.Geometry documents invalid geometry as undefined behaviour, and unioning real-world polygons (BAG building footprints, for instance) regularly produces intermediate results that Boost.Geometry itself then rejects as invalid. Those get repaired with GEOS MakeValid, but the repair does not always yield geometry that Boost.Geometry accepts.

Up to and including 20.13.0 the still-invalid geometry was passed on to boost::geometry::union_ anyway, which could kill the process without any [E] line in the log (#1176). Since that issue the engine cleans degenerate rings out of the repair result and raises a regular error instead of continuing into undefined behaviour, so a failure is now reported rather than fatal — but the operator still cannot complete a union over such data.

syntax

  • bg_union_polygon(polygon_data_item)
  • bg_union_polygon(polygon_data_item, relation)

description

bg_union_polygon(polygon_data_item, partitioning) results in an attribute with all polygons from polygon_data_item, grouped by the argument relation.

Lines between adjacent polygons within each group are removed.

The domain unit of the resulting attribute is the values unit of the relation.

In other GIS software, the term dissolve is often used for this operation.

conditions

  1. The composition type of the polygon_data_item item needs to be a polygon with an ipoint, spoint, fpoint, or dpoint value type.
  2. The domain unit of the polygon_data_item item must be of value type uint32.
  3. The domain unit of arguments polygon_data_item and relation must match.
  4. The order of points in the polygon_data_item needs to be clockwise for exterior bounds and counterclockwise for holes in polygons (right-hand rule).

function type

  • bg_union_polygon(D->*P) -> void->*P
  • bg_union_polygon(D->*P, part_rel: D->R) -> R->*P

where P is a GeoDms point type with signed integer coordinates, i.e. 16, 32, or 64-bit signed integers, D is the domain of the argument, and R is the values unit of the partitioning part_rel.

since version

15.6.0

example

parameter<fpoint> geometry (polygon) := bg_union_polygon(district/geometry);
attribute<fpoint> geometry (polygon, region) := bg_union_polygon(district/geometry, district/region_rel);

see also

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