BBBikeDownloader.get_valid_download_info(subregion_name, osm_file_format, download_dir=None, **kwargs)[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.

  • subregion_name (str) – name of a (sub)region available on BBBike free download server

  • osm_file_format (str) – file format/extension of the OSM data available on the download server

  • download_dir (str | None) – directory for saving the downloaded file(s), defaults to None; when download_dir=None, it refers to the method cdd()

  • kwargs – [optional] parameters of, including mkdir


valid subregion name, filename, download url and absolute file path

Return type:



>>> from pydriosm.downloader import BBBikeDownloader
>>> import os

>>> bbd = BBBikeDownloader()

>>> subrgn_name = 'birmingham'
>>> file_format = "pbf"

>>> # valid subregion name, filename, download url and absolute file path
>>> info = bbd.get_valid_download_info(subrgn_name, file_format)
>>> valid_subrgn_name, pbf_filename, dwnld_url, pbf_pathname = info

>>> valid_subrgn_name
>>> pbf_filename
>>> dwnld_url
>>> os.path.relpath(pbf_pathname)

>>> # Create a new instance with a given download directory
>>> bbd = BBBikeDownloader(download_dir="tests\osm_data")
>>> _, _, _, pbf_pathname = bbd.get_valid_download_info(subrgn_name, file_format)

>>> os.path.relpath(pbf_pathname)