regularize_footprints

regularize_footprints#

rapidtools.processing.postprocessing.footprints.regularize_footprints(polygons: Sequence[BaseGeometry | None], *, priorities: Sequence[float] | None = None, neighbor_radius: float | None = 40.0, remove_overlaps: bool = True, min_area: float = 4.0, min_feature: float | None = None, rectangle_iou: float = 0.92, min_iou: float = 0.82) → list[Polygon | None][source]#

Regularize a set of neighboring footprints together.

Each footprint is redrawn with regularize_footprint(), also trying the wall direction its neighbors share (houses along a street are usually parallel), and the results are then made non-overlapping with resolve_overlaps().

Parameters:
  • polygons – Footprints in a planar CRS in meters.

  • priorities – Which footprint keeps contested area (larger wins); defaults to the area.

  • neighbor_radius – Search radius for the shared wall direction, in meters; None disables it.

  • remove_overlaps – Resolve overlaps between the results.

  • min_area – Results smaller than this (m^2) become None.

  • min_feature – See regularize_footprint().

  • rectangle_iou – See regularize_footprint().

  • min_iou – See regularize_footprint().

Returns:

list[Polygon | None] – One entry per input, None where the footprint was empty, degenerate or too small.

Example

>>> from shapely.geometry import box
>>> out = regularize_footprints([box(0, 0, 10, 8), box(9.5, 0, 20, 8)])
>>> round(out[0].intersection(out[1]).area, 6)
0.0