_Downloader
- class pydriosm.downloader._Downloader(download_dir=None)
Initialization of a data downloader.
- Parameters:
download_dir (str or os.PathLike[str] or None) – name or pathname of a directory for saving downloaded data files, defaults to
None
; whendownload_dir=None
, downloaded data files are saved to a folder named ‘osm_data’ under the current working directory- Variables:
download_dir (str or None) – name or pathname of a directory for saving downloaded data files
data_paths (list) – pathnames of all downloaded data files
Tests:
>>> from pydriosm.downloader import _Downloader >>> import os >>> d = _Downloader() >>> d.NAME 'OSM Downloader' >>> os.path.relpath(d.download_dir) 'osm_data' >>> os.path.relpath(d.cdd()) 'osm_data' >>> d.download_dir == d.cdd() True >>> d = _Downloader(download_dir="tests\osm_data") >>> os.path.relpath(d.download_dir) 'tests\osm_data'
Attributes
str: Default download directory.
set: Valid file formats.
str: Full name of the data resource.
str: Name of the free download server.
set: Valid subregion names.
Methods
cdd
(*sub_dir[, mkdir])Change directory to default download directory and its subdirectories or a specific file.
compose_cfm_msg
([data_name, file_path, ...])Compose a short message to be printed for confirmation.
file_exists
(subregion_name, osm_file_format)Check if the data file of a queried geographic (sub)region already exists locally, given its default filename.
file_exists_and_more
(subregion_names, ...[, ...])Check if a requested data file already exists and compile information for downloading the data.
get_default_sub_path
(subregion_name_, ...)Get default sub path for saving OSM data file of a geographic (sub)region.
get_prepacked_data
(meth[, data_name, ...])Get auxiliary data (that is to be prepacked in the package).
get_subregion_download_url
(subregion_name, ...)Get a download URL of a geographic (sub)region.
get_valid_download_info
(subregion_name, ...)Get information of downloading (or downloaded) data file.
make_subregion_dirname
(subregion_name_)Make the name of the directory one level up from an OSM data file of a geographic (sub)region.
print_act_msg
([data_name, verbose, ...])Print a short message showing the action as a function runs.
print_otw_msg
([data_name, path_to_file, ...])Print a short message for an otherwise situation.
validate_file_format
(osm_file_format[, ...])Validate an input file format of OSM data.
validate_subregion_name
(subregion_name[, ...])Validate an input name of a geographic (sub)region.
verify_download_dir
(download_dir, ...)Verify the pathname of the current download directory.