GeofabrikDownloader
- class pydriosm.downloader.GeofabrikDownloader(download_dir=None)
Download OSM data from Geofabrik free download server.
- Parameters:
download_dir (str or os.PathLike[str] or None) – name or pathname of a directory for saving downloaded data files, defaults to
None
; whendownload_dir=None
, downloaded data files are saved to a folder named ‘osm_data’ under the current working directory- Variables:
valid_subregion_names (set) – names of (sub)regions available on the free download server
valid_file_formats (set) – filename extensions of the data files available
download_index (pandas.DataFrame) – index of downloads for all available (sub)regions
continent_tables (dict) – download catalogues for each continent
region_subregion_tier (dict) – region-subregion tier
having_no_subregions (list) – all (sub)regions that have no subregions
catalogue (pandas.DataFrame) – a catalogue (index) of all available downloads (similar to
download_index
)download_dir (str or None) – name or pathname of a directory for saving downloaded data files
data_pathnames (list) – list of pathnames of all downloaded data files
Examples:
>>> from pydriosm.downloader import GeofabrikDownloader >>> import os >>> gfd = GeofabrikDownloader() >>> gfd.NAME 'Geofabrik' >>> gfd.URL 'https://download.geofabrik.de/' >>> gfd.DOWNLOAD_INDEX_URL 'https://download.geofabrik.de/index-v1.json' >>> os.path.relpath(gfd.download_dir) 'osm_data\geofabrik' >>> gfd = GeofabrikDownloader(download_dir="tests\osm_data") >>> os.path.relpath(gfd.download_dir) 'tests\osm_data'
Attributes
Default download directory.
URL of the official download index.
Valid file formats.
Full name of the data resource.
Name of the free download server.
URL of the homepage to the free download server.
Methods
download_osm_data
(subregion_names, ...[, ...])Download OSM data (in a specific format) of one (or multiple) geographic (sub)region(s).
download_subregion_data
(subregion_names, ...)Download OSM data (in a specific file format) of all subregions (if available) for one (or multiple) geographic (sub)region(s).
file_exists
(subregion_name, osm_file_format)Check whether a data file of a geographic (sub)region already exists locally, given its default filename.
get_catalogue
([update, ...])Get a catalogue (index) of all available downloads.
get_continent_tables
([update, ...])Get download catalogues for each continent.
get_default_filename
(subregion_name, ...[, ...])get a default filename for a geograpic (sub)region.
get_default_pathname
(subregion_name, ...[, ...])Get the default pathname of a local directory for storing a downloaded data file.
get_download_index
([update, ...])Get the official index of downloads for all available geographic (sub)regions.
get_raw_directory_index
(url[, verbose])Get a raw directory index (including download information of older file logs).
get_region_subregion_tier
([update, ...])Get region-subregion tier and all (sub)regions that have no subregions.
get_subregion_download_url
(subregion_name, ...)Get a download URL of a geographic (sub)region.
get_subregion_table
(url[, verbose])Get download information of all geographic (sub)regions on a web page.
get_subregions
(*subregion_name[, deep])Retrieve names of all subregions (if any) of the given geographic (sub)region(s).
get_valid_download_info
(subregion_name, ...)Get information of downloading (or downloaded) data file.
get_valid_subregion_names
([update, ...])Get names of all available geographic (sub)regions.
specify_sub_download_dir
(subregion_name, ...)Specify a directory for downloading data of all subregions of a geographic (sub)region.
validate_file_format
(osm_file_format, **kwargs)Validate an input file format of OSM data.
validate_subregion_name
(subregion_name, **kwargs)Validate an input name of a geographic (sub)region.