Skip to main content

sidewalkreator

A lightweight tool for generating sidewalks from OSM data.

This repository contains a headless (CLI / library) version of the QGIS plugin OSM Sidewalkreator.

Installation

Python 3.11 or newer is required; CI tests Python 3.11–3.14 on Linux. The distribution name is sidewalkreator; the Python import remains headless_sidewalkreator. Version 0.1.0 is being prepared for its first PyPI release. Until published, install from a checkout with python -m pip install .. After publication:

python -m pip install sidewalkreator
sidewalkreator --help

Generated geometry is a mapping starting point requiring review, not a verified production pedestrian network. Full same-input QGIS GUI geometry parity remains an acceptance task. See release instructions.

API Overview

Planet Download API

You can now use cloud-optimized planet files (Overture Maps or Protomaps) as data sources:

result = sidewalkreator(
    bbox=(-72.53, 42.37, -72.52, 42.38),
    parameters={
        "provider": "overture",
        "provider_kwargs": {"release": "2026-06-17.0"}
    }
)

See PLANET_SOURCES.md for more details.

The library provides several APIs for different use cases:

Full Sidewalk Generation API

The sidewalkreator() function accepts and returns GeoDataFrames, giving users full control over I/O.

Note: This function was previously named generate_sidewalks_gdf(). The old name is still available for backward compatibility but is deprecated.

Input options (choose one):

from headless_sidewalkreator import sidewalkreator
import geopandas as gpd

# Option 1: Use a polygon GeoDataFrame
input_polygon_gdf = gpd.read_file("area_of_interest.geojson")
result = sidewalkreator(input_polygon_gdf=input_polygon_gdf)

# Option 2: Use a place name (geocoded automatically)
result = sidewalkreator(place_name="Amherst, MA")

# Option 3: Use a bounding box (minx, miny, maxx, maxy)
result = sidewalkreator(bbox=(-72.53, 42.37, -72.52, 42.38))

# All options support additional parameters
result = sidewalkreator(
    bbox=(-72.53, 42.37, -72.52, 42.38),
    parameters={"buffer_dist": 2.0},  # Optional custom parameters
    ignore_existing=False
)

# Extract results - all are GeoDataFrames
sidewalks = result['sidewalks']
crossings = result['crossings'] 
kerbs = result['kerbs']
protoblocks = result['protoblocks']  # For analysis/debugging
parameters_used = result['parameters']

# User handles output as needed
sidewalks.to_file("output_sidewalks.geojson")
crossings.to_file("output_crossings.gpkg")

Standalone Protoblocks Generation API

The generate_protoblocks() function generates only the protoblocks (enclosed areas formed by street networks) without creating sidewalks. This is useful for urban analysis, block-level studies, or as input for other algorithms.

from headless_sidewalkreator import generate_protoblocks
import geopandas as gpd

# Same input options as sidewalkreator
protoblocks = generate_protoblocks(
    input_polygon_gdf=your_polygon_gdf
    # OR place_name="Your City, State"
    # OR bbox=(minx, miny, maxx, maxy)
)

# Result is a GeoDataFrame of polygon geometries
print(f"Generated {len(protoblocks)} protoblocks")
protoblocks.to_file("protoblocks_output.geojson")

Command-Line Usage

The tool can also be used from the command line with three input options:

# Option 1: Use a GeoJSON polygon file
sidewalkreator --input-file area.geojson --output-dir ./output

# Option 2: Use a place name (geocoded automatically)  
sidewalkreator --place-name "Amherst, MA" --output-dir ./output

# Option 3: Use a bounding box (minx miny maxx maxy)
sidewalkreator --bbox -72.53 42.37 -72.52 42.38 --output-dir ./output

# All options support additional parameters
sidewalkreator --bbox -72.53 42.37 -72.52 42.38 --output-dir ./output --ignore-existing

Alternative: The tool can also be invoked using python -m headless_sidewalkreator with the same arguments.

Development setup

Modern versions of geopandas and related geospatial libraries come with bundled binaries on supported Python/platform combinations. File I/O uses GeoPandas 1.0+ and its default Pyogrio backend; Fiona is not required. Python 3.15 verification is deferred until upstream native dependencies are ready; see the TODO in the publishing guide.

Quick setup (Python 3.11+):

  1. Create and activate a Python virtual environment:
python3 -m venv .venv
source .venv/bin/activate

# upgrade pip and build tools
python -m pip install --upgrade pip setuptools wheel
  1. Install all dependencies:
# install in editable mode with development dependencies
pip install -e .[dev]

Alternative: Conda setup

If you prefer conda:

conda create -n hs-env python=3.12 -y
conda activate hs-env

# install via conda-forge for potentially faster geospatial package installation
conda install -c conda-forge geopandas osmnx -y

# install remaining dependencies in editable mode
pip install -e .[dev]

Running tests

With the virtual environment active and dependencies installed:

# run tests (uses pytest)
pytest -q

QGIS GUI parity

The original QGIS GUI implementation is the behavioral reference for this headless port. The parity regressions in test/test_qgis_gui_parity.py cover the following rules:

  • positive sidewalk tags create diagnostic sure zones in QGIS but do not clip unrelated generated sidewalks;
  • side-specific and negative sidewalk tags remove only the GUI-defined side;
  • a crossing is emitted only after both sidewalk-axis intersections are found;
  • road segments shorter than 20 metres are skipped by default, matching the GUI control;
  • each candidate's 1 m center buffer must be contained by a generated protoblock;
  • crossing rays are parallel to the smallest-angle incident street by default, matching the GUI's selected radio option; and
  • the committed QGIS grid fixture yields 6 sidewalks, 14 crossings, and 28 kerbs from the headless pipeline.

The segment-length, center-containment, and direction assumptions can be overridden explicitly:

parameters = {
    "min_crossing_segment_length": value_in_metres,
    "crossing_center_buffer_distance": value_in_metres,
    "crossing_direction_mode": "parallel",  # or "perpendicular"
}

The parallel option is applied consistently at both endpoint orientations. The current GUI source appears to fall back to perpendicular at its P0 branch because that call does not request an index from point_forms_minor_angle_w2. Consequently, the source-derived tests and the count fixture are sufficient to trigger a fresh parity run, but production acceptance still requires geometry-level comparison with a GUI export made from the same frozen OSM input.

Editable install and quick run

To install the package in editable/development mode:

pip install -e .

# then you can import the package in Python
python -c "from headless_sidewalkreator import sidewalkreator; print(sidewalkreator.__doc__)"

Notes

  • The package uses OSMnx to fetch OpenStreetMap data. OSMnx's features_ helpers return GeoDataFrames and are preferred; the code falls back to older geometries_ names if necessary.
  • CI workflow is provided in .github/workflows/ci.yml which installs dependencies and runs the test suite on GitHub Actions.

If you'd like, I can add a Makefile or small helper scripts to automate these steps.

This is the headless version of a QGIS Plugin called OSM Sidewalkreator, available at:

https://github.com/kauevestena/osm_sidewalkreator

TODO: Restore Python 3.15 verification in both the source-test and installed-wheel CI matrices once the native dependency ecosystem is ready. Verification is deferred as of September 22, 2026; Python 3.15 is not currently verified or a release gate. Python 3.11–3.14 remain required, with matrix fail-fast disabled.

Metadata

Release files for sidewalkreator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sidewalkreator 0.1.0
File Size Uploaded Provenance Actions
sidewalkreator-0.1.0.tar.gz 85.4 kB With provenance Details for sidewalkreator-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sidewalkreator 0.1.0
File Interpreter ABI Platform Actions
sidewalkreator-0.1.0-py3-none-any.whl Python 3 none any Details for sidewalkreator-0.1.0-py3-none-any.whl

Total release size: 144.0 kB

Release files / sidewalkreator-0.1.0.tar.gz

Download URL sidewalkreator-0.1.0.tar.gz
Size 85.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3f5ea61910137152376d7cf01fe224706f503af4126bcd88e18bfcbf3759301b
BLAKE2b-256 checksum
How to use checksums
f1932ff0cf55adeeef79855f827582cd517ce002dbba73fd2bb5811f4a07aae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / sidewalkreator-0.1.0-py3-none-any.whl

Download URL sidewalkreator-0.1.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a0964f7efa363b0f3bc3a26c0d7926005e41fc4d75497b21f69dec4937cd0e5
BLAKE2b-256 checksum
How to use checksums
922570adb61bcc79ef3d29540feddca730b5c1e139033b9656d955199f36f92d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for sidewalkreator 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sidewalkreator-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page