How to extract street graph or network from OpenStreetMap ?
There are many solutions to achieve this goal, I listed some of them below.
Overpass-api & overpass-turbo let you use overpass query language to collect ways and nodes of type highway for a city :
[out:xml]; area[name = "Pantin"]; (way(area)[highway]; ); (._;>;); out;
Geofabrik allows you to download various datasets from continents to cities.
Next, extract nodes and ways of type highway using Osmium tag-filters:
osmium tags-filter map.osm w/highway -o highways-ways.osm
NOTE: osmium tags-filter also works with .pbf files
Ophois is a CLI tool written in Rust, i created to:
I also created a simple tool to display the generated graph on a Leaflet map to check the simplification process, cartographe.
Cartographe let you check the node id and the distance of links in meters using haversine formula.
NOTE: Simplified and discretized with 10 meters parameter
OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.
NOTE: Pantin using OSMnx