Skip to content

outer_single_polygon

Maarten Hilferink edited this page Apr 8, 2026 · 1 revision

Geometric functions outer_single_polygon

The outer_single_polygon function extracts only the outer ring from single polygons, removing any holes.

syntax

outer_single_polygon(polygons: E->Polygon<Point>) -> E->Polygon<Point>

Alias: This is also available as bg_outer_single_polygon for boost geometry coordinates.

definition

Removes holes from each single polygon, keeping only the outer boundary ring. The result is a simple polygon without any interior rings.

For polygons without holes, the output is identical to the input.

arguments

argument description type
polygons Single polygon geometries E->Polygon

performance

Time complexity: O(n × v) where n is the number of polygons and v is the average number of vertices per polygon.

Memory efficient as it typically reduces geometry size by removing hole vertices.

conditions

  • Input must be single polygons (not multi-polygons)
  • For multi-polygons, use outer_multi_polygon

example

unit<uint32> Buildings: nrofrows = 100;
attribute<DPoint> building_footprint (poly, Buildings);  // may have courtyards (holes)

// Remove courtyards, keep only outer boundary
attribute<DPoint> outer_boundary (poly, Buildings) := outer_single_polygon(building_footprint);

// Useful for simplified visualization or area calculations including holes
attribute<Float64> gross_area (Buildings) := area(outer_boundary);
attribute<Float64> net_area (Buildings) := area(building_footprint);
attribute<Float64> courtyard_area (Buildings) := gross_area - net_area;

see also

since version

7.0

Clone this wiki locally