GeofabrikDownloader.get_default_pathname

GeofabrikDownloader.get_default_pathname(subregion_name, osm_file_format, mkdir=False, update=False, verbose=False)[source]

Get the default pathname of a local directory for storing a downloaded data file.

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

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

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

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

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

  • verbose (bool | 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[str, str]

Examples:

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

>>> gfd = GeofabrikDownloader()

>>> # Default filename and download path of the PBF data of London
>>> subrgn_name, file_format = 'london', ".pbf"

>>> pathname, filename = gfd.get_default_pathname(subrgn_name, file_format)
>>> os.path.relpath(os.path.dirname(pathname))
'osm_data\geofabrik\europe\great-britain\england\greater-london'
>>> filename
'greater-london-latest.osm.pbf'