GeofabrikDownloader.get_default_path_to_osm_file

GeofabrikDownloader.get_default_path_to_osm_file(subregion_name, osm_file_format, mkdir=False, update=False, verbose=False)

Get a default path to a local directory for storing a downloaded data file.

The default file path is derived from the relevant download URL for the requested data file.

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

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

  • mkdir (bool) – whether to create a directory, defaults to False

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

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

Returns

default filename of the subregion and default (absolute) path to the file

Return type

tuple

Example:

>>> import os
>>> from pydriosm.downloader import GeofabrikDownloader

>>> geofabrik_downloader = GeofabrikDownloader()

>>> # Default filename and download path of the PBF data of London
>>> filename, file_path = geofabrik_downloader.get_default_path_to_osm_file(
...     subregion_name='London', osm_file_format=".pbf")

>>> print(filename)
greater-london-latest.osm.pbf

>>> print(os.path.relpath(file_path))
osm_geofabrik\Europe\Great Britain\England\Greater London\greater-lond...