get_osm_pbf_layer_names

pydriosm.reader.get_osm_pbf_layer_names(path_to_osm_pbf)

Get indices and names of all layers in a PBF data file.

Parameters

path_to_osm_pbf (str) – path to a PBF data file

Returns

indices and names of each layer of the PBF data file

Return type

dict

Example:

>>> import os
>>> from pydriosm.downloader import GeofabrikDownloader
>>> from pydriosm.reader import get_osm_pbf_layer_names

>>> # Download the PBF data file of Rutland as an example
>>> geofabrik_downloader = GeofabrikDownloader()

>>> path_to_rutland_pbf = geofabrik_downloader.download_osm_data(
...     subregion_names='Rutland', osm_file_format=".pbf", download_dir="tests",
...     verbose=True, ret_download_path=True)
To download .osm.pbf data of the following geographic region(s):
    Rutland
? [No]|Yes: yes
Downloading "rutland-latest.osm.pbf" to "tests\" ... Done.

>>> # Get indices and names of all layers in the downloaded PBF data file
>>> lyr_idx_names = get_osm_pbf_layer_names(path_to_rutland_pbf)

>>> for k, v in lyr_idx_names.items():
...     print(f'{k}: {v}')
0: points
1: lines
2: multilinestrings
3: multipolygons
4: other_relations

>>> # Delete the downloaded PBF data file
>>> os.remove(path_to_rutland_pbf)