_Downloader.file_exists

_Downloader.file_exists(subregion_name, osm_file_format, data_dir=None, update=False, verbose=True, ret_file_path=False)

Check if the data file of a queried geographic (sub)region already exists locally, given its default filename.

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

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

  • data_dir (str or None) – directory where the data file (or files) is (or are) stored, defaults to None; when data_dir=None, it refers to the method cdd()

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

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

  • ret_file_path (bool) – whether to return the pathname of the data file (if it exists), defaults to False

Returns:

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

Return type:

bool or str

Tests:

>>> from pydriosm.downloader import _Downloader

>>> d = _Downloader()

>>> d.file_exists('<subregion_name>', 'shp')
False