GeofabrikDownloader.validate_subregion_name
- GeofabrikDownloader.validate_subregion_name(subregion_name, valid_subregion_names=None, raise_err=True, **kwargs)[source]
Validate an input name of a geographic (sub)region.
The validation is done by matching the input to a name of a geographic (sub)region available on Geofabrik free download server.
- Parameters:
subregion_name (str) – name/URL of a (sub)region available on Geofabrik free download server
valid_subregion_names (Iterable) – names of all (sub)regions available on a free download server
raise_err (bool) – (if the input fails to match a valid name) whether to raise the error
pydriosm.downloader.InvalidSubregionName
, defaults toTrue
kwargs – [optional] parameters of pyhelpers.text.find_similar_str()
- Returns:
valid subregion name that matches (or is the most similar to) the input
- Return type:
str
Examples:
>>> from pydriosm.downloader import GeofabrikDownloader >>> gfd = GeofabrikDownloader() >>> input_subrgn_name = 'london' >>> valid_subrgn_name = gfd.validate_subregion_name(subregion_name=input_subrgn_name) >>> valid_subrgn_name 'Greater London' >>> input_subrgn_name = 'https://download.geofabrik.de/europe/great-britain.html' >>> valid_subrgn_name = gfd.validate_subregion_name(subregion_name=input_subrgn_name) >>> valid_subrgn_name 'Great Britain'