GeofabrikDownloader.search_for_subregions

GeofabrikDownloader.search_for_subregions(*subregion_name, deep=False)

Retrieve names of all subregions (if any) of the given geographic region(s).

The is based on the region-subregion tier.

See also [RNS-1].

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

  • deep (bool) – whether to get subregion names of the subregions, defaults to False

Returns

list of subregions (if any); if subregion_name=None, all regions that do have subregions

Return type

list

Examples:

>>> from pydriosm.downloader import GeofabrikDownloader

>>> geofabrik_downloader = GeofabrikDownloader()

>>> # Names of all (sub)regions
>>> region_names = geofabrik_downloader.search_for_subregions()

>>> len(region_names) > 400
True
>>> region_names[:5]
['Antarctica', 'Algeria', 'Angola', 'Benin', 'Botswana']
>>> region_names[-5:]
['centro-oeste', 'nordeste', 'norte', 'sudeste', 'sul']

>>> # Names of all subregions of England and North America
>>> region_names = geofabrik_downloader.search_for_subregions('england', 'n america')

>>> len(region_names)
99
>>> region_names[:5]
['Bedfordshire', 'Berkshire', 'Bristol', 'Buckinghamshire', 'Cambridgeshire']
>>> region_names[-5:]
['Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']

>>> # Names of subregions of Great Britain
>>> region_names = geofabrik_downloader.search_for_subregions('britain')
>>> len(region_names)
3
>>> region_names
['England', 'Scotland', 'Wales']

>>> # Names of all subregions of Great Britain's subregions
>>> region_names = geofabrik_downloader.search_for_subregions('britain', deep=True)
>>> len(region_names)
49
>>> region_names[:5]
['Scotland', 'Wales', 'Bedfordshire', 'Berkshire', 'Bristol']
>>> region_names[-5:]
['West Midlands', 'West Sussex', 'West Yorkshire', 'Wiltshire', 'Worcestershire']