OpenStreetMap data
Working with OpenStreetMap itself: reading PBF extracts, points of interest, roads, rivers, land use, railways, parks, cycle lanes, charging stations and buildings, the edit history, the licence, and the tagging traps that make counts wrong.
OpenStreetMap is the richest open map of the world, and also a database with no fixed schema, edited by many people and tools. The guides here work with it directly: reading Geofabrik PBF extracts with pyosmium and DuckDB, and pulling out points of interest, roads, water, land use, railways, parks, cycle lanes, charging stations and building heights. They also cover exporting the results, analysing the edit history with the ohsome API, and the licence that comes with the data.
Every number comes from a run on the dated extract of Washington, D.C. of 1 October 2026. With areas enabled, pyosmium returned 24,237 amenity features where 16,960 exist; a parks-only filter missed Rock Creek Park; every one of 6,378 speed limits carried mph, so pd.to_numeric parsed none; and 99% of the District’s buildings were added in just three years, almost all of them in two bulk imports.
🧭 Start with the concepts
The ideas the how-to guides below assume you already have.
⚙️ Then do the task
Step-by-step walkthroughs with code you can copy and adapt.
- How to Read an OpenStreetMap PBF File in Python
- How to Get Points of Interest From OpenStreetMap in Python
- How to Get Roads by Type From OpenStreetMap in Python
- How to Get Rivers and Water Bodies From OpenStreetMap in Python
- How to Get Land Use Polygons From OpenStreetMap in Python
- How to Get Railway Lines and Stations From OpenStreetMap in Python
Show every how-to guide in this topic
- How to Analyse OpenStreetMap History in Python With the ohsome API
- How to Find Parks and Green Space in OpenStreetMap With Python
- How to Map Cycle Lanes From OpenStreetMap in Python
- How to Find EV Charging Stations in OpenStreetMap With Python
- How to Get Building Heights and Levels From OpenStreetMap in Python
- How to Export OpenStreetMap Data to GeoPackage or Shapefile in Python
🔧 When it breaks
The errors this topic produces, with the cause explained rather than just the command.
- Fixing OpenStreetMap Features Counted Twice as Lines and Polygons
- Fixing OpenStreetMap Lakes and Parks That Show as Lines Instead of Polygons
- Fixing OpenStreetMap maxspeed Values That Are Not Numbers
- Fixing an OpenStreetMap Tag Filter That Misses Features
- Fixing Boundary Polygons Missing From an OpenStreetMap Extract
Related topics
Subjects that keep coming up alongside this one, most overlap first.