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 parse OSM data faster and make it more feasible to extract data covering large regions.

_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

  • export networks as a directed graph to igraph, networkx and pandana

When should I use Pyrosm?#

Pyrosm can of course be used whenever you need to parse data from OSM into geopandas GeoDataFrames. However, pyrosm is better suited for situations where you want to fetch data for whole city or larger regions (even whole country).

If you are interested to fetch OSM data for smaller areas such as neighborhoods, or search data around a specific location/address, we recommend using OSMnx which is more flexible in terms of specifying the area of interest. That being said, it is also possible to extract neighborhood level information with pyrosm and filter data based on a bounding box (see docs).

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.

Getting started#

Contents

Indices and tables#