FootprintRegularizer

FootprintRegularizer#

class rapidtools.processing.FootprintRegularizer(min_area_m2: float = 4.0, min_feature_m: float | None = None, rectangle_iou: float = 0.92, neighbor_radius_m: float | None = 40.0, remove_overlaps: bool = True, keep_original: bool = False)[source]#

Bases: object

Pipeline component that gives building footprints straight, square walls.

This is pure geometry and needs no model or imagery: every polygonal asset in the collection gets the outline from regularize_footprints() (computed in a local transverse Mercator plane), neighboring footprints are made non-overlapping, and footprints that end up smaller than min_area_m2 are dropped. Assets keep their IDs and attributes; non-polygonal assets pass through unchanged.

Parameters:
  • min_area_m2 (float, optional) – Smallest footprint kept, in m^2. Defaults to 4.

  • min_feature_m (float | None, optional) – Bulges, dents and steps narrower than this are removed. Defaults to a size-dependent value between 0.6 and 1.5 m.

  • rectangle_iou (float, optional) – Footprints whose oriented rectangle overlaps them at least this well become rectangles. Defaults to 0.92.

  • neighbor_radius_m (float | None, optional) – Radius in which neighbors share their wall direction; None disables it. Defaults to 40.

  • remove_overlaps (bool, optional) – Make the footprints mutually non-overlapping (higher confidence attribute, then larger area, keeps the contested part). Defaults to True.

  • keep_original (bool, optional) – Store the input outline as WKT in the 'unregularized_geometry_wkt' attribute. Defaults to False.

Example

>>> from rapidtools.core import PhysicalAssetCollection
>>> from rapidtools.processing import FootprintRegularizer
>>> raw = PhysicalAssetCollection.from_geojson('buildings_raw.geojson')
>>> clean = FootprintRegularizer()(raw)
>>> clean.to_geojson('buildings_clean.geojson')