Skip to main content

Add your description here

Project description

Building Footprint Regularization

A Python library for regularizing building footprints in geospatial data. This library helps clean up and standardize building polygon geometries by aligning edges to principal directions, correcting geometric irregularities.

Python License

Example Results

Before and after regularization:

Before and After Regularization

Overview

Building footprints extracted from remote sensing imagery often contain noise, irregular edges, and geometric inconsistencies. This library provides tools to regularize these footprints by:

  • Aligning edges to principal directions
  • Converting near-rectangular buildings to perfect rectangles
  • Simplifying complex polygons while maintaining their essential shape

Inspired by RS-building-regularization, this library takes a geometric approach to building regularization with improvements for usability and integration with the GeoPandas ecosystem.

Installation

pip install buildingregulariser

Quick Start

import geopandas as gpd
from buildingregulariser import regularize_geodataframe

# Load your building footprints
buildings = gpd.read_file("buildings.gpkg")

# Regularize the building footprints
regularized_buildings = regularize_geodataframe(
    buildings, 
)

# Save the results
regularized_buildings.to_file("regularized_buildings.gpkg")

Features

  • GeoDataFrame Integration: Works seamlessly with GeoPandas GeoDataFrames
  • CRS Handling: Intelligently handles coordinate reference systems
  • Polygon Regularization: Aligns edges to principal directions
  • Edge Simplification: Reduces the number of vertices while preserving shape
  • Geometry Cleanup: Fixes invalid geometries and removes artifacts

Usage Examples

Basic Regularization

from buildingregulariser import regularize_geodataframe
import geopandas as gpd

buildings = gpd.read_file("buildings.gpkg")
regularized = regularize_geodataframe(buildings)

Working with Different Coordinate Systems

regularized = regularize_geodataframe(
    buildings,
    target_crs="EPSG:3857"  # Web Mercator projection
)

Fine-tuning Regularization Parameters

regularized = regularize_geodataframe(
    buildings,
    parallel_threshold=2.0,   # Higher values allow more edge alignment
    simplify=True,
    simplify_tolerance=0.5    # Controls simplification level
)

Parameters:

  • geodataframe: Input GeoDataFrame with polygon geometries
  • parallel_threshold: Distance threshold for handling parallel lines (default: 1.0)
  • target_crs: Target CRS for reprojection. If None, uses the input CRS
  • simplify: If True, applies simplification to the geometry (default: True)
  • simplify_tolerance: Tolerance for simplification (default: 0.5)

Returns:

  • A new GeoDataFrame with regularized polygon geometries

How It Works

  1. Edge Analysis: Analyzes each polygon to identify principal directions
  2. Edge Orientation: Aligns edges to be either parallel or perpendicular to the main direction
  3. Edge Connection: Ensures proper connectivity between oriented edges

License

This project is licensed under the MIT License

Acknowledgments

This library was inspired by the RS-building-regularization project, with improvements for integration with the GeoPandas ecosystem and enhanced regularization algorithms.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

buildingregulariser-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

buildingregulariser-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file buildingregulariser-0.1.0.tar.gz.

File metadata

  • Download URL: buildingregulariser-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for buildingregulariser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 036abaa2d4d64ffed99b956c49dca5d063808f4ca29a90d5e991d9abec3a4b90
MD5 76bf3bc71ed23b6ab5934b2663547c83
BLAKE2b-256 44e27fdb62d2e272230259ba517feb68e9c7a1723ecd4cfa9a80e776e26ca47b

See more details on using hashes here.

File details

Details for the file buildingregulariser-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for buildingregulariser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b8f4d0f1348fd993ad2e9ca8e301b72b087e456855bf06011ee1cddeaa8bc9e
MD5 b10d73796952d8c1c0977b2728c66662
BLAKE2b-256 2ba6e4305a73b0982f4acf8859d74992b391055f0a66f159e33b946f13ee65d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page