GeofabrikDownloader.get_subregion_table
- classmethod GeofabrikDownloader.get_subregion_table(url, verbose=False)[source]
Get download information of all geographic (sub)regions on a web page.
- Parameters:
url (str) – URL of a subregion’s web page
verbose (bool | int) – whether to print relevant information in console, defaults to
False
- Returns:
download information of all available subregions on the given
url
- Return type:
pandas.DataFrame | None
Examples:
>>> from pydriosm.downloader import GeofabrikDownloader >>> gfd = GeofabrikDownloader() >>> # Download information on the homepage >>> homepage = gfd.get_subregion_table(url=gfd.URL) >>> homepage subregion ... .osm.bz2 0 Africa ... https://download.geofabrik.de/africa-latest.os... 1 Antarctica ... https://download.geofabrik.de/antarctica-lates... 2 Asia ... https://download.geofabrik.de/asia-latest.osm.bz2 3 Australia and Oceania ... https://download.geofabrik.de/australia-oceani... 4 Central America ... https://download.geofabrik.de/central-america-... 5 Europe ... https://download.geofabrik.de/europe-latest.os... 6 North America ... https://download.geofabrik.de/north-america-la... 7 South America ... https://download.geofabrik.de/south-america-la... [8 rows x 6 columns] >>> homepage.columns.to_list() ['subregion', 'subregion-url', '.osm.pbf', '.osm.pbf-size', '.shp.zip', '.osm.bz2'] >>> # Download information about 'Great Britain' >>> great_britain_url = 'https://download.geofabrik.de/europe/great-britain.html' >>> great_britain = gfd.get_subregion_table(great_britain_url) >>> great_britain subregion ... .osm.bz2 0 England ... https://download.geofabrik.de/europe/great-bri... 1 Scotland ... https://download.geofabrik.de/europe/great-bri... 2 Wales ... https://download.geofabrik.de/europe/great-bri... [3 rows x 6 columns] >>> # Download information about 'Antarctica' >>> antarctica_url = 'https://download.geofabrik.de/antarctica.html' >>> antarctica = gfd.get_subregion_table(antarctica_url, verbose=True) Compiling information about subregions of "Antarctica" ... Failed. >>> antarctica is None True >>> # To get more information about the above failure, set `verbose=2` >>> antarctica2 = gfd.get_subregion_table(antarctica_url, verbose=2) Compiling information about subregions of "Antarctica" ... Failed. No subregion data is available for "Antarctica" on Geofabrik's free download server. >>> antarctica2 is None True