_Downloader.file_exists_and_more

_Downloader.file_exists_and_more(subregion_names, osm_file_format, data_dir=None, update=False, confirmation_required=True, verbose=True)

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

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

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

  • data_dir (str or 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 or int) – whether to print relevant information in console, defaults to True

Returns

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

Return type

tuple

Tests:

>>> from pydriosm.downloader import GeofabrikDownloader, BBBikeDownloader

>>> gfd = GeofabrikDownloader()

>>> gfd.file_exists_and_more('London', ".pbf")
(['Greater London'], '.osm.pbf', True, 'download', ['Greater London'], [])

>>> gfd.file_exists_and_more(['london', 'rutland'], ".pbf")
(['Greater London', 'Rutland'],
 '.osm.pbf',
 True,
 'download',
 ['Greater London', 'Rutland'],
 [])

>>> bbd = BBBikeDownloader()

>>> bbd.file_exists_and_more('London', ".pbf")
(['London'], '.pbf', True, 'download', ['London'], [])

>>> bbd.file_exists_and_more(['birmingham', 'leeds'], ".pbf")
(['Birmingham', 'Leeds'],
 '.pbf',
 True,
 'download',
 ['Birmingham', 'Leeds'],
 [])