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.
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
- Installation
- Basic usage
- Protobuf file: What is it and how to get one?
- Initializing the Pyrosm OSM -reader object
- Read street networks
- Read buildings
- Read Points of Interest
- Read landuse
- Read natural
- Read boundaries
- Read OSM data with custom filter
- Filtering data based on bounding box
- Pyrosm/OSM tagging system
- Export street networks to graph
- Customizing the queries
- Working with graphs
- Contributing to pyrosm
Reference Guide
- Reference to All Attributes and Methods
- Changelog
- v0.6.2 (Oct 26, 2023)
- v0.6.1 (Oct 11, 2021)
- v0.6.0 (Nov 18, 2020)
- v0.5.3 (Sep 13, 2020)
- v0.5.1/2 (May 11, 2020)
- v0.5.0 (May 7, 2020)
- v0.4.3 (April 27, 2020)
- v0.4.2 (April 23, 2020)
- v0.4.1 (April 17, 2020)
- v0.4.0 (April 16, 2020)
- v0.3.1 (April 15, 2020)
- v0.2.0 (April 13, 2020)
- v0.1.8 (April 8, 2020)
- v0.1.0 (April 7, 2020)