_Downloader.get_valid_download_info
- _Downloader.get_valid_download_info(subregion_name, osm_file_format, download_dir=None, **kwargs)
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 (sub)region available on a free download server
osm_file_format (str) – file format/extension of the OSM data available on the download server
download_dir (str or None) – directory for saving the downloaded file(s), defaults to
None
; whendownload_dir=None
, it refers to the methodcdd()
kwargs – [optional] parameters of pyhelpers.dirs.cd(), including
mkdir``(default: ``False
)
- Returns:
valid subregion name, filename, download url and absolute file path
- Return type:
tuple
Tests:
>>> from pydriosm.downloader import _Downloader >>> import os >>> d = _Downloader() >>> valid_dwnld_info = d.get_valid_download_info('subregion_name', 'osm_file_format') >>> valid_dwnld_info[0] == '<subregion_name_>' True >>> valid_dwnld_info[1] == '<download_url>' True >>> valid_dwnld_info[2] == '<download_url>' True >>> os.path.relpath(valid_dwnld_info[3]) 'osm_data\<subregion_name_>\<download_url>'
See also
Examples for the methods: