BBBikeDownloader.file_exists_and_more

BBBikeDownloader.file_exists_and_more(subregion_names, osm_file_formats, data_dir=None, update=False, confirmation_required=True, verbose=True, deep=False)[source]

Check if a requested data file already exists and compile information for downloading the data.

Parameters:
  • subregion_names (str | list) – name(s) of geographic (sub)region(s) available on a free download server

  • osm_file_formats (str) – file format of the OSM data available on the free download server

  • data_dir (str | None) – directory where the data file (or files) is (or are) stored, defaults to None

  • update (bool) – whether to (check on and) update the data, defaults to False

  • confirmation_required (bool) – whether asking for confirmation to proceed, defaults to True

  • verbose (bool | int) – whether to print relevant information in console, defaults to True

  • deep (bool) – whether to further check availability of sub-subregions data, defaults to False

Returns:

whether the requested data file exists; or the path to the data file

Return type:

tuple

Examples:

>>> from pydriosm.downloader import GeofabrikDownloader, BBBikeDownloader
>>> gfd = GeofabrikDownloader()
>>> gfd.file_exists_and_more('London', ".pbf")
(['Greater London'],
 ['.osm.pbf'],
 True,
 'Proceed to download data in the format '.osm.pbf' for the following geographic ...
 [])
>>> gfd.file_exists_and_more(['london', 'rutland'], ".pbf")
(['Greater London', 'Rutland'],
 ['.osm.pbf'],
 True,
 'Proceed to download data in the format '.osm.pbf' for the following geographic ...
 [])
>>> gfd.file_exists_and_more(['london', 'rutland'], ["shp", ".pbf"])
(['Greater London', 'Rutland'],
 ['.shp.zip', '.osm.pbf'],
 True,
 'Proceed to download data in the formats ('.shp.zip', '.osm.pbf') for the foll...
 [])
>>> bbd = BBBikeDownloader()
>>> bbd.file_exists_and_more('London', ".pbf")
(['London'],
 ['.pbf'],
 True,
 'Proceed to download data in the format '.pbf' for the following geographic (sub...
 [])
>>> bbd.file_exists_and_more(['birmingham', 'leeds'], ".pbf")
(['Birmingham', 'Leeds'],
 ['.pbf'],
 True,
 'Proceed to download data in the format '.pbf' for the following geographic (sub...
 [])