Pyrosm is a Python library for reading OpenStreetMap data 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 and natural elements. Also fully customized queries are supported which makes it possible to parse the data from OSM 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 over internet using OverPass API, whereas pyrosm reads the data from local OSM data dumps that can be downloaded e.g. from GeoFabrik's website. The library has been developed by keeping performance in mind, hence, it is mainly written in Cython (Python with C-like performance) which makes it fast to parse OpenStreetMap data from PBF files. With the opt-in out-of-core ("streaming") engine added in v0.10.0, it is possible to read whole-country (or even continent) extracts quickly without running out of memory. Pyrosm decodes the PBF data with Google's Protocol Buffers library (using its fast upb C backend). Protocol Buffers is a commonly used and efficient method to serialize and compress structured data which is also used by OpenStreetMap contributors to distribute the OSM data in PBF format (Protocolbuffer Binary Format).
Backend change. Since v0.8.0, the backend used to parse the protocol-buffer messages is Google's Protobuf (its fast C
upbbackend) instead of the previously used Pyrobuf. The switch was made for maintainability and installation reliability: Pyrobuf is no longer maintained and its source build fails with modernsetuptools, which brokepip install pyrosm, whereas Google's Protobuf is actively maintained and ships prebuilt wheels and conda-forge packages for Python 3.10–3.14. The change does not slow down parsing — see the backend benchmark. v0.7.0 was the last release that used Pyrobuf.
Out-of-core ("streaming") engine (v0.10.0). Pyrosm now ships an opt-in out-of-core reading engine, selected with
OSM(filepath, engine="out_of_core"), that decodes large PBF files in a single streaming pass with bounded memory — the decode, the node-coordinate gather and the standalone-way read all run in parallel across a worker pool, and each layer's result is cached automatically. It reads whole-country and even whole-continent extracts (e.g. all of South America) quickly on modest machines without running out of memory, returning GeoDataFrames identical to the default in-memory reader (which is unchanged).
Documentation is available at https://pyrosm.readthedocs.io.
engine="out_of_core"), with parallel decoding and automatic result caching (NEW in v0.10.0)igraph, networkx and pandarm, optionally with topological simplification (NEW in v0.11.0)Pyrosm is distributed via PyPI and conda-forge.
The recommended way to install pyrosm is from conda-forge with mamba (or its standalone variant micromamba), a fast drop-in replacement for conda. If you don't have it yet, download and install mamba via Miniforge from the conda-forge download page — it ships mamba preconfigured with the conda-forge channel. Then install pyrosm with:
$ mamba install -c conda-forge pyrosm
or, with micromamba:
$ micromamba install -c conda-forge pyrosm
(the same command works with conda if you have it). You can also install the package with pip:
$ pip install pyrosm
Notice that pyrosm requires geopandas to work. On Linux and Mac installing geopandas with pip should work without a problem, which is handled automatically when installing pyrosm.
However, on Windows installing geopandas with pip is likely to cause issues, hence, it is recommended to install Geopandas before installing pyrosm. See instructions from Geopandas website.
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).
Using pyrosm is straightforward. See docs for instructions how to use the library.
If you find a bug from the tool, have question, or would like to suggest a new feature to it, you can make a new issue here.
We warmly welcome contributions to pyrosm to make it better. If you are interested in contributing to the library, please check the contribution guidelines.
You can install a local development version of the tool by 1) creating an environment with the necessary packages using mamba/micromamba and 2) building pyrosm from source:
create an environment for one of the supported Python versions (3.10–3.14) by:
test by default): $ mamba env create -f ci/314-conda.yaml (or $ micromamba create -f ci/314-conda.yaml)ci/ (e.g. ci/312-conda.yaml)build pyrosm development version from master (activate the environment first):
pip install -e . --no-build-isolation--no-build-isolation builds the Cython extensions against the build dependencies provided by the environment, i.e. Cython and cykhash, instead of refetching and recompiling them in an isolated build environment)You can run tests with pytest by executing:
$ pytest . -v
If you use pyrosm in your research or other work, please cite it. Pyrosm is archived on Zenodo, which provides a citable DOI (10.5281/zenodo.3755057, always resolving to the latest version). An example citation for the pyrosm version 0.11.0 is as follows:
Tenkanen, H. (2026). pyrosm: A Python library for reading and writing OpenStreetMap PBF data with GeoDataFrames. (v0.11.0) Zenodo. https://doi.org/10.5281/zenodo.3755057
A BibTeX entry and version-specific DOIs are available in the documentation and on the Zenodo record.
Pyrosm is licensed under MIT (see license).
The OSM data is downloaded from two sources:
Data © Geofabrik GmbH, BBBike and OpenStreetMap Contributors
All data from the OpenStreetMap is licensed under the OpenStreetMap License.