Polygon filtered

Geometric functions polygon filtered

syntax

  • bp_polygon_filtered(polygon_data_item, minArea)
  • bp_union_polygon_filtered(polygon_data_item, minArea)
  • bp_union_polygon_filtered(polygon_data_item, partitioning, minArea)
  • bp_split_polygon_filtered(polygon_data_item, minArea)
  • bp_split_union_polygon_filtered(polygon_data_item, minArea)
  • bp_split_union_polygon_filtered(polygon_data_item, partitioning, minArea)

description

The _filtered suffix removes small polygons from the result of a boost polygon operator: it keeps the polygons, and parts of polygons, whose area is at least minArea, and drops everything smaller. Internally the Boost Polygon keep operation is used with minArea as the lower bound of the area.

It is one of three suffixes on the four base operators bp_polygon, bp_union_polygon, bp_split_polygon and bp_split_union_polygon; the other two, _inflated and _deflated, grow or shrink the polygons by a distance, see Boost polygon functions. For example bp_union_polygon_filtered dissolves and then removes the small resulting polygons. The suffixes exist for the bp_ operators only and do not combine: to deflate and then filter, nest two operators.

applies to

  • Attribute polygon_data_item with a point Value type with integer coordinates (ipoint or spoint) and composition type polygon.
  • Parameter minArea with a Float64 value type, an area in squared units of the coordinate system. Polygons with a smaller area are removed.
  • the optional partitioning argument of the union forms is a relation that gives per polygon the group to dissolve within.

As for the other Boost Polygon operators, coordinate values must stay below 2^25 (about 33 km when coordinates are in mm) after the first point is translated to (0, 0); convert to a coarser unit (cm or dm) for large extents.

minArea, and likewise the size argument of _inflated and _deflated, may also be an Attribute of the domain of polygon_data_item, with a value per polygon, also for the split and union forms on a domain of more than one Tile.

since version

8.041

example

// keep only polygons with an area of at least 1000 (squared coordinate units)
attribute<ipoint> big_districts (polygon, district) := bp_polygon_filtered(district/geometry, 1000d);

// dissolve the districts per region, then drop the small slivers
attribute<ipoint> dissolved_clean (polygon, region) := bp_union_polygon_filtered(district/geometry, district/region_rel, 1000d);

// deflate by 5, then remove the polygons that became too small
attribute<ipoint> eroded (polygon, district) := bp_polygon_filtered(bp_polygon_deflated(district/geometry, 5d), 250d);

see also