Skip to content

Get started

From an OpenStreetMap extract to a lane-level page: three duckOSM commands and one call.

Install

Python 3.10 or newer. lanestyle brings roadstyle (0.21 or newer), geopandas, shapely 2, duckdb and pandas; duckOSM makes the data (it needs SUMO's netconvert for the lanes).

pip install lanestyle "duckosm[levels]"

Make the data

duckosm build --pbf monaco-latest.osm.pbf -o monaco.duckdb -m driving -m walking -m cycling
duckosm gmns monaco.duckdb -o monaco_gmns.duckdb
duckosm levels monaco.duckdb
step makes what is in it
build monaco.duckdb the roads of every mode, routable, with the OSM tags
gmns monaco_gmns.duckdb the lanes (count, width, use: car, bus, bike), the turns between them and where each junction begins (from SUMO), the crossings
levels monaco.levels/ the drawing order of the roads: which is over which, their ends. Your fixes go here too (the editor)

Draw it

import lanestyle as ls

m = ls.lane_page("monaco.levels", "monaco_gmns.duckdb", "monaco.duckdb")
m.save("monaco.html")

or from the repo: python lane_page.py monaco.levels monaco_gmns.duckdb monaco.duckdb monaco.html.

The page is one HTML file that opens offline. Zoom in: lanes and their colours show at every zoom, lane lines, zebras and sidewalks from zoom 17, arrows and BUS / bike marks from 18. Click a lane to see it; click a road for its name, class and modes.

The page is blank, just the lanes: no base map, no Roads box, no Tunnels slider. Extra keywords go to roadstyle's render_edges: basemap= (a base map under the lanes), filter_control=True, tunnel_control=True, name= and the rest.

Next