_Reader.read_osm_pbf
- _Reader.read_osm_pbf(subregion_name, data_dir=None, readable=False, expand=False, parse_geometry=False, parse_properties=False, parse_other_tags=False, update=False, download=True, pickle_it=False, ret_pickle_path=False, rm_pbf_file=False, chunk_size_limit=50, verbose=False, **kwargs)
Read a PBF (.osm.pbf) data file of a geographic (sub)region.
- Parameters
subregion_name (str) – name of a geographic (sub)region (case-insensitive) that is available on Geofabrik free download server
data_dir (str or None) – directory where the .osm.pbf data file is located/saved; if
None
, the default local directoryreadable (bool) – whether to parse each feature in the raw data, defaults to
False
expand (bool) – whether to expand dict-like data into separate columns, defaults to
False
parse_geometry (bool) – whether to represent the
'geometry'
field in a shapely.geometry format, defaults toFalse
parse_properties (bool) – whether to represent the
'properties'
field in a tabular format, defaults toFalse
parse_other_tags (bool) – whether to represent a
'other_tags'
(of'properties'
) in a dict format, defaults toFalse
download (bool) – whether to download/update the PBF data file of the given subregion, if it is not available at the specified path, defaults to
True
update (bool) – whether to check to update pickle backup (if available), defaults to
False
pickle_it (bool) – whether to save the .pbf data as a pickle file, defaults to
False
ret_pickle_path (bool) – (when
pickle_it=True
) whether to return a path to the saved pickle filerm_pbf_file (bool) – whether to delete the downloaded .osm.pbf file, defaults to
False
chunk_size_limit (int or None) – threshold (in MB) that triggers the use of chunk parser, defaults to
50
; if the size of the .osm.pbf file (in MB) is greater thanchunk_size_limit
, it will be parsed in a chunk-wise wayverbose (bool or int) – whether to print relevant information in console as the function runs, defaults to
False
kwargs – [optional] parameters of the method
PBFReadParse.read_pbf()
- Returns
dictionary of the .osm.pbf data; when
pickle_it=True
, return a tuple of the dictionary and a path to the pickle file- Return type
dict or tuple or None
See examples for the methods
GeofabrikReader.read_osm_pbf()
andBBBikeReader.read_osm_pbf()
.