Pyrosm

Pyrosm is a Python library for reading OpenStreetMap from Protocolbuffer Binary Format -files (*.osm.pbf) into Geopandas GeoDataFrames. Pyrosm makes it easy to extract various datasets from OpenStreetMap pbf-dumps including e.g. road networks, buildings, Points of Interest (POI), landuse, natural elements, administrative boundaries and much more. Fully customized queries are supported which makes it possible to parse any kind of data from OSM, even with more specific filters.

Pyrosm is easy to use and it provides a somewhat similar user interface as OSMnx. The main difference between pyrosm and OSMnx is that OSMnx reads the data using an OverPass API, whereas pyrosm reads the data from local OSM data dumps that are downloaded from the PBF data providers (Geofabrik, BBBike). This makes it possible to read data much faster, thus allowing to parse OSM data covering large regions in a matter of minutes instead of hours.

For instance, parsing all roads from the state of New York (USA) with a “basic” work laptop (16GB memory, SSD, and Intel Core i5 CPU), takes less than 3 minutes and parsing the buildings from the same region takes less than 4 minutes (see benchmarks for details):

_images/NY_roads_and_buildings.PNG

Current features

  • download PBF data easily from hundreds of locations across the world

  • read street networks (separately for driving, cycling, walking and all-combined)

  • read buildings from PBF

  • read Points of Interest (POI) from PBF

  • read landuse from PBF

  • read “natural” from PBF

  • read boundaries from PBF (such as administrative borders)

  • read any other data from PBF by using a custom user-defined filter

  • filter data based on bounding box

License

Pyrosm is licensed under MIT (see license).

Data © Geofabrik GmbH, BBBike and OpenStreetMap Contributors. All data from the OpenStreetMap is licensed under the OpenStreetMap License.

Indices and tables