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)[source]¶ 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 (case-insensitive) available on Geofabrik’s free download server
osm_file_format (str) – OSM file format; valid values include
".osm.pbf"
,".shp.zip"
and".osm.bz2"
mkdir (bool) – whether to create a directory, defaults to
False
update (bool) – whether to check on update and proceed to 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() >>> sr_name = 'london' >>> file_format = ".pbf" >>> filename, file_path = geofabrik_downloader.get_default_path_to_osm_file( ... sr_name, file_format) >>> print(filename) greater-london-latest.osm.pbf >>> print(os.path.relpath(file_path)) dat_GeoFabrik\Europe\Great Britain\England\greater-london-latest.osm.pbf