BBBikeDownloader.get_subregion_download_url¶
- BBBikeDownloader.get_subregion_download_url(subregion_name, osm_file_format, update=False, verbose=False, raise_error=True)[source]¶
Get a valid URL for downloading OSM data of a specific file format for a geographic (sub)region.
- Parameters:
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
update (bool) – whether to (check on and) update the prepacked data, defaults to
Falseverbose (bool | int) – whether to print relevant information in console, defaults to
Falseraise_error (bool) – (if the input fails to match a valid name) whether to raise an
pydriosm.errors.InvalidSubregionNameErrororInvalidFileFormatError; defaults toTrue
- Returns:
a valid name of
subregion_nameand a download URL for the givenosm_file_format- Return type:
tuple
Examples:
>>> from pydriosm.downloader import BBBikeDownloader >>> bbd = BBBikeDownloader() >>> subregion_name, osm_file_format = 'birmingham', "pbf" >>> # Get a valid subregion name and its download URL >>> subregion_name_, download_url = bbd.get_subregion_download_url( ... subregion_name, osm_file_format) >>> subregion_name_ 'Birmingham' >>> download_url 'https://download.bbbike.org/osm/bbbike/Birmingham/Birmingham.osm.pbf' >>> osm_file_format = "csv.xz" >>> subregion_name_, download_url = bbd.get_subregion_download_url( ... subregion_name, osm_file_format) >>> subregion_name_ 'Birmingham' >>> download_url 'https://download.bbbike.org/osm/bbbike/Birmingham/Birmingham.osm.csv.xz'