API reference#
The OSM class is the main entry point: construct it once from a PBF file,
then call a feature method to read a layer into a GeoDataFrame, export a network to a graph,
or write data back to PBF. Module-level helpers download PBF extracts and simplify graphs.
OSM reader#
Constructor#
|
OpenStreetMap PBF reader object. |
Reading OSM features#
|
Parses street networks from OSM for walking, driving, and cycling. |
|
Parses buildings from OSM: the building ways and relations, and with |
|
Parse Point of Interest (POI) from OSM. |
|
Parses landuse from OSM. |
|
Parses natural from OSM. |
|
Parses boundaries from OSM. |
Parse OSM data based on custom criteria. |
Exporting to a graph#
|
Read the street network of |
|
Export OSM network to routable graph. |
Saving, cropping and merging PBF files#
|
Crop the source PBF by this object's |
|
Write the OSM data this object holds back to a valid, re-readable |
|
Merge overlapping |
Cache and downloads#
|
List the out-of-core engine's cached layer files -- the GeoParquet files that |
List the PBF files downloaded by |
|
|
Remove the out-of-core engine's result cache -- the GeoParquet files that |
|
Remove PBF files downloaded or cropped into the default download directory ( |
Downloading data#
|
Get the path to a PBF data file, and download the data if needed. |
|
List the OSM extracts that overlap |
|
Download the OSM data for |
|
Download (and by default crop) the OSM data covering a bounding box. |
|
Geocode a place name to a Shapely polygon via Nominatim. |
|
Download (and by default crop) the OSM data for a geocoded place name. |
Logging#
|
Show pyrosm's log messages, and set how every operation shows its progress. |
Exceptions#
No Geofabrik, BBBike or Movisda extract contains the requested area. |
|
|
No extract that contains the requested area could be downloaded. |
|
A file could not be downloaded, after retrying network errors and HTTP status 408, 425, 429 and 5xx. |
The file is not a readable OSM PBF file, for example because it is truncated or another format; the message names the file. |
|
The PBF file requires a feature pyrosm does not support, such as node locations stored on ways; the message names the file and the feature. |
|
Base class of the errors about the content of a PBF file. |
Graph simplification#
|
Topologically simplify pyrosm's directed graph-export edges. |
Graph tables#
|
The nodes and edges of a graph as GeoDataFrames, as the graph exporters build it: the edges directed (see |