BBBikeDownloader.get_valid_download_info

BBBikeDownloader.get_valid_download_info(subregion_name, osm_file_format, download_dir=None)[source]

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), package data directory

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()

>>> sr_name = 'leeds'
>>> file_fmt = 'pbf'

>>> info = bbbike_downloader.get_valid_download_info(sr_name, file_fmt)
>>> sr_name_, pbf_filename, dwnld_url, path_to_pbf = info

>>> print(sr_name_)
Leeds
>>> print(pbf_filename)
Leeds.osm.pbf
>>> print(dwnld_url)
http://download.bbbike.org/osm/bbbike/Leeds/Leeds.osm.pbf
>>> print(os.path.relpath(path_to_pbf))
dat_BBBike\Leeds\Leeds.osm.pbf