Skip to main content

duckOSM

OpenStreetMap → a routable road network in one DuckDB file,
with edge IDs that survive every rebuild, clip and export.

PyPI CI Docs Python 3.10+ License MIT

Documentation · Your first network · Guides · Database schema · Query the database


Why duckOSM

Most OSM-to-network tools number their edges 0, 1, 2, …, so the numbers change whenever you rebuild, cut out an area or export, and every table keyed on them has to be matched again. duckOSM's edge_id is a content hash of three ids that OpenStreetMap already gives the road segment: the OSM way it comes from (osm_id) and the OSM nodes where it starts and ends (source, target):

edge_id = hash(osm_id, source, target)

The order of source and target is the direction, so the two directions of a two-way street get different ids. None of the three is a number duckOSM makes up, so the id stays the same across rebuilds, clips and exports (details).

Quick start

pip install "duckosm[routing]"

curl -LO https://download.geofabrik.de/europe/monaco-latest.osm.pbf
duckosm build --pbf monaco-latest.osm.pbf --output monaco.duckdb --modes driving
import duckdb
from duckosm import route

con = duckdb.connect("monaco.duckdb", read_only=True)
q = "SELECT min(edge_id) FROM driving.edges WHERE name = ?"
a = con.execute(q, ["Boulevard du Larvotto"]).fetchone()[0]
b = con.execute(q, ["Avenue Princesse Grace"]).fetchone()[0]

r = route(con, a, b)                     # fastest path; weight="length" for distance
r["time_s"], r["length_m"], r["edges"]   # ~114 s, ~1.5 km, the ordered edge_ids

What you get

  • A driving, a walking and a cycling network in one file, one schema each, split at the same junctions so a road has the same edge_id in every mode. OSM access tags are respected: private roads are kept for the map but never routed (details).
  • The graph of legal turns (edge_graph), with OSM turn restrictions, for routing in SQL, Python or networkx.
  • Base-map layers (features.*: water, land use, buildings, POIs) in the same file.
  • Maps in one offline HTML page: duckosm viz draws the network and the base map from the database; duckosm route-map is a route planner (drive, walk, cycle, walk + drive) where you drag a start and an end and get turn-by-turn directions (try it). The pages are drawn by mapstyle.
  • The drawing order of the roads: duckosm levels stores which road is painted over which (casing and fill numbers) in the file (how).
  • Any area: a GeoJSON boundary, a place name, a box or an H3 cell; duckosm boundary finds an area's border by name, and duckosm extract cuts a city out of a country build in seconds.
  • Your own fixes for OSM errors, applied on every build (how).
  • A Rust engine for the network step (rust/), the default since 2026-11-04 (options.engine: rust). The Python engine stays as the reference until the next release.
  • In the browser: duckOSM Studio builds the same tables in a web page, with the same Rust engine. Its panel Edit OSM data (web/fixes_editor/) writes the fixes file that duckosm build reads (how).
  • Edit on your computer: duckosm edit my_area.duckdb opens the same panel on a page on your computer, and Build again builds the area with your fixes (how).

Exports

Format Command How it's verified
SUMO duckosm sumo SUMO's own netconvert assembles the network
MATSim duckosm matsim, matsim-lanes validated against MATSim's official DTD and XSD schemas
GMNS duckosm gmns follows the GMNS table spec
GeoPackage / shapefile duckosm export-gis duckosm gis-debug reads it back through GDAL and diffs every edge_id
networkx duckosm export-graph unit tests

Experimental: OpenDRIVE, Lanelet2, railML, lane-level routing, GMNS meso/micro, intermodal routing, elevation, admin boundaries, base-map layers. See the documentation.

For AI agents

  • To use duckOSM: the agent skill skills/duckosm/SKILL.md (also a Claude Code plugin: /plugin marketplace add Khoshkhah/duckOSM), and the whole documentation as one text file: llms-full.txt (llms.txt is its index).
  • duckosm info DB --json says what a database holds; way, route-lanes and gis-debug also take --json.
  • To change duckOSM: the rules are in AGENTS.md.

License

MIT. duckOSM is built on DuckDB and its spatial extension; it is an independent project, not affiliated with or endorsed by the DuckDB Foundation.

Metadata

Release files for duckosm 0.7.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 duckosm 0.7.0
File Size Uploaded Provenance Actions
duckosm-0.7.0.tar.gz 587.4 kB With provenance Details for duckosm-0.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for duckosm 0.7.0
File Actions
duckosm-0.7.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for duckosm-0.7.0-cp39-abi3-win_amd64.whl
duckosm-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for duckosm-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl
duckosm-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for duckosm-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl
duckosm-0.7.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for duckosm-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
duckosm-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for duckosm-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 52.5 MB

Release files / duckosm-0.7.0.tar.gz

Download URL duckosm-0.7.0.tar.gz
Size 587.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c5af5fa13a8cc8e5ffb522015a804549d160521059a9054dbdbfd0781a75a9f5
BLAKE2b-256 checksum
How to use checksums
3afb46e93fb08ac3afea0bac3d61226152ac86b4c90a583ac43c7fbe454064bc
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 6, 2026.

Transparency log

Release files / duckosm-0.7.0-cp39-abi3-win_amd64.whl

Download URL duckosm-0.7.0-cp39-abi3-win_amd64.whl
Size 10.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
57bbef179fe71db215c6f3bb0904330b81392e52bcd9213e6a6a67cc44bb2159
BLAKE2b-256 checksum
How to use checksums
40565198ae21a1a3489df59d710e050357caa64047b60a5c3ee543315d72b09a
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 6, 2026.

Transparency log

Release files / duckosm-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL duckosm-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 10.8 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
2133399d47066b20c6e698cb391bb4024bd353d5e70098d1002d276a2dd0de4a
BLAKE2b-256 checksum
How to use checksums
689f12092a09d2f317249daefe2238eccce2b1337ba4d43a46fbdbbf928e1c7f
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 6, 2026.

Transparency log

Release files / duckosm-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL duckosm-0.7.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 10.7 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
cc85b07cfeefd3ee27d883c57e426d84d9f7227f1f36d53737593547334f26d7
BLAKE2b-256 checksum
How to use checksums
1024074909b0fd78ce5eac42233fdef36a9868f84e1127c92c4e89085266cf21
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 6, 2026.

Transparency log

Release files / duckosm-0.7.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL duckosm-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Size 10.0 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1b4e7cc120622e605b674865734807604d55a839cb759ce6e4df49358b71d108
BLAKE2b-256 checksum
How to use checksums
f499d99c21581a4a6e829182fb3c8d0ac4ae6b2b465db0aa30353d14208bc61f
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 6, 2026.

Transparency log

Release files / duckosm-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL duckosm-0.7.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 10.3 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
784b540152b172cb604ce03833df85f1c8d3c3e7d77081d1c32c0604298985cd
BLAKE2b-256 checksum
How to use checksums
074ffb8f7f358ce4286c025504f14345e8592e125980dedd8820215fc3b3a6de
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 6, 2026.

Transparency log

Security for duckosm 0.7.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

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for duckosm-0.7.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 Nov 6, 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.

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