OpenStreetMap → a routable road network in one DuckDB file,
with edge IDs that survive every rebuild, clip and export.
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_idin 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 vizdraws the network and the base map from the database;duckosm route-mapis 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 levelsstores 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 boundaryfinds an area's border by name, andduckosm extractcuts a city out of a country build in seconds. - Your own fixes for OSM errors, applied on every build (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.txtis its index). duckosm info DB --jsonsays what a database holds;way,route-lanesandgis-debugalso 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.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| duckosm-0.5.0.tar.gz | 388.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| duckosm-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 703.5 kB
Release files / duckosm-0.5.0.tar.gz
| Download URL | duckosm-0.5.0.tar.gz |
|---|---|
| Size | 388.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a62969eaf21dad1207f282686a94fd2649571c2cba16174ef76124761cde0795
|
|
BLAKE2b-256 checksum How to use checksums |
b75c444058c75275269a2e802f06ca501863a14b52ed23f0585b34928ed518b2
|
| 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 21, 2026.
Transparency logRelease files / duckosm-0.5.0-py3-none-any.whl
| Download URL | duckosm-0.5.0-py3-none-any.whl |
|---|---|
| Size | 315.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e22e126a9e708a6662f5ee38993986ac2f5d18a6ed69189a02529b12d3c8c8d
|
|
BLAKE2b-256 checksum How to use checksums |
a50248640835cd361091a3cffeb56e26ff5edb09f4fbeceb6bf1119d9727b7da
|
| 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 21, 2026.
Transparency logSecurity for duckosm 0.5.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 2 files in this release have been uploaded with provenance metadata.
Attestation for duckosm-0.5.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 21, 2026.
Transparency logA 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.