Skip to main content

NetworkForge

PyPI tests coverage

NetworkForge

Turn GIS line layers into street networks a router can use. Add your own roads, cycleways and paths to OpenStreetMap, change or remove existing streets, or build a network from your own lines alone. You get OSM PBF files for routers (tested in Valhalla and R5) and a GeoPackage to look at in QGIS.

Using QGIS? The NetworkForge plugin runs this for you.

What it does

  • Add proposed roads, cycleways and paths. They join the streets they cross, unless one is a bridge, a tunnel or on another layer.
  • Change or remove existing streets by editing attributes: make one one-way, close it, pedestrianise it, change its speed limit.
  • Ban or force turns, and add bollards, signals and crossings.
  • Build a network from your own lines alone, with no OpenStreetMap.
  • Before and after: the untouched network and the changed one, to compare routes, travel times and catchments.

Streets are described with OpenStreetMap tags as plain attributes (highway, maxspeed, oneway, ...) or with a preset for the whole layer. Values are checked before anything is built.

Install

pip install networkforge              # Python 3.12 or newer
pip install "networkforge[traffic]"   # with time-of-day traffic for Valhalla

Or run it without installing: uvx networkforge.

Use

# Check a layer's attributes (seconds, no download)
networkforge check --custom proposed.gpkg --preset primary_road

# Build: every line a 40 mph primary road, before and after
networkforge build --extent area.gpkg --custom proposed.gpkg \
    --preset primary_road --tag maxspeed="40 mph" \
    --out after.osm.pbf --baseline-out before.osm.pbf \
    --gpkg after.gpkg --baseline-gpkg before.gpkg

# A network from your own lines alone
networkforge build --no-osm --custom streets.gpkg --out network.osm.pbf

The same in Python:

import geopandas as gpd
from networkforge import build_network, write_osm

nodes, edges = build_network(gpd.read_file("area.gpkg"),
                             gpd.read_file("proposed.gpkg"),
                             preset="primary_road",
                             network_tags={"maxspeed": "40 mph"})
write_osm(nodes, edges, "after.osm.pbf")

OpenStreetMap is downloaded for areas up to 1,000 km². For bigger areas, give a downloaded extract with --osm-source (how).

What you get

Output For Holds
.osm.pbf or .osm Routers: Valhalla, R5, GraphHopper, OpenTripPlanner OpenStreetMap as it is, every tag and turn restriction kept, plus your changes
GeoPackage QGIS edges, nodes and restrictions layers; edges have car / bike / walk, speed, travel time and direction columns for QGIS's own network tools

The PBF is the product. The GeoPackage is a simpler view of it: it says who may use a street, which way and how fast, but QGIS's own network tools ignore turn restrictions and barriers. Route on the PBF when those matter.

What it doesn't do

  • Public transport. No timetables. Combine the PBF with GTFS in r5py or OpenTripPlanner.
  • Traffic simulation. Travel times come from speed limits. networkforge traffic adds time-of-day speeds you assume or have measured, for Valhalla; nothing reacts to them.
  • Redrawing streets. An existing street can be changed or removed. To move one, remove it and draw the new line.

Documentation

Development

uv sync
uv run pytest               # offline tests, about 2 minutes
uv run pytest -m valhalla   # routes on the PBF with Valhalla
uv run pytest -m network    # live OpenStreetMap downloads
uv run ruff check .

Every rule is tested by routing on the PBF with Valhalla, and the main ones with R5 too. The GeoPackage is checked with QGIS's own tools. To release, set version in pyproject.toml, add a section to the changelog and push a vX.Y.Z tag: the release workflow tests, builds and publishes to GitHub and PyPI.

Licence

GPL-3.0. Networks built with OpenStreetMap contain data © OpenStreetMap contributors, under the Open Database License.

Metadata

Release files for networkforge 1.4.2

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

Source distribution (sdist)

Source distribution for networkforge 1.4.2
File Size Uploaded Provenance Actions
networkforge-1.4.2.tar.gz 361.2 kB With provenance Details for networkforge-1.4.2.tar.gz

Built distribution (wheel)

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

Total release size: 488.2 kB

Release files / networkforge-1.4.2.tar.gz

Download URL networkforge-1.4.2.tar.gz
Size 361.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c403f98984dc55f5fcf7bbe905b7fda109bfe6f63dc7b7206773bcae37d6e76d
BLAKE2b-256 checksum
How to use checksums
c32ec86a3beb2f29d3e24d053a4d3dfa77d184127f0a8ac5d063bfeb96fe8cae
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 Nov 19, 2026.

Transparency log

Release files / networkforge-1.4.2-py3-none-any.whl

Download URL networkforge-1.4.2-py3-none-any.whl
Size 127.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce933cb1b604c47a46f374eac11f4a46b3034f7772d7a10db3122630cbf09503
BLAKE2b-256 checksum
How to use checksums
377df5484f44387509f6cccca6b8ffaa5b515b3842c69622fb7ea87db60f24de
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 Nov 19, 2026.

Transparency log

Security for networkforge 1.4.2

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 networkforge-1.4.2.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 Nov 19, 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

1.4.2 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