get_osm_pbf_layer_names¶
-
pydriosm.reader.
get_osm_pbf_layer_names
(path_to_osm_pbf)[source]¶ Get names of all layers in a PBF data file.
- Parameters
path_to_osm_pbf (str) – absolute path to a PBF data file
- Returns
name (and index) of each layer of the PBF data file
- Return type
dict
Example:
>>> import os >>> from pydriosm.reader import GeofabrikDownloader, get_osm_pbf_layer_names >>> geofabrik_downloader = GeofabrikDownloader() >>> sr_name = 'Rutland' >>> file_fmt = ".pbf" >>> dwnld_dir = "tests" >>> path_to_rutland_pbf = geofabrik_downloader.download_osm_data( ... sr_name, file_fmt, dwnld_dir, verbose=True, ret_download_path=True) Confirmed to download .osm.pbf data of the following geographic region(s): Rutland ? [No]|Yes: yes Downloading "rutland-latest.osm.pbf" to "\tests" ... Done. >>> 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)