mask_to_polygons#

mask_to_polygons(mask: ndarray, transform: affine.Affine | None = None) Iterator[BaseGeometry][source]#

Polygonize a raster mask. Wrapper around rasterio.features.shapes.

Parameters:
  • mask (ndarray) – The mask containing buildings to polygonize.

  • transform (affine.Affine | None) – Affine transform to use during polygonization. Defaults to None (i.e. identity transform).

Returns:

Generator of shapely polygons.

Return type:

Iterator[BaseGeometry]