BBBikeDownloader.get_valid_download_info¶
-
BBBikeDownloader.
get_valid_download_info
(subregion_name, osm_file_format, download_dir=None, mkdir=False)¶ Get information of downloading (or downloaded) data file.
The information includes a valid subregion name, a default filename, a URL and an absolute path where the data file is (to be) saved locally.
- Parameters
subregion_name (str) – name of a geographic region (case-insensitive)
osm_file_format (str) – format (file extension) of an OSM data
download_dir (str or None) – directory where downloaded OSM file is saved; if
None
(default), the default directory created by the packagemkdir (bool) – whether to create a directory, defaults to
False
- Returns
valid subregion name, filename, download url and absolute file path
- Return type
tuple
Examples:
>>> import os >>> from pydriosm.downloader import BBBikeDownloader >>> bbbike_downloader = BBBikeDownloader() >>> region_name = 'leeds' >>> file_format = 'pbf' >>> # valid subregion name, filename, download url and absolute file path >>> info = bbbike_downloader.get_valid_download_info(region_name, file_format) >>> sub_reg_name, pbf_filename, dwnld_url, path_to_pbf = info >>> print(sub_reg_name) Leeds >>> print(pbf_filename) Leeds.osm.pbf >>> print(dwnld_url) https://download.bbbike.org/osm/bbbike/Leeds/Leeds.osm.pbf >>> print(os.path.relpath(path_to_pbf)) osm_bbbike\Leeds\Leeds.osm.pbf