BBBikeDownloader.validate_subregion_name

BBBikeDownloader.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 subregion_name to a name of a geographic (sub)region available on BBBike free download server.

Parameters:
  • subregion_name (str) – name of a (sub)region available on BBBike 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 to True

Returns:

valid (sub)region name that matches, or is the most similar to, the input

Return type:

str

Examples:

>>> from pydriosm.downloader import BBBikeDownloader

>>> bbd = BBBikeDownloader()

>>> subrgn_name = 'birmingham'

>>> valid_name = bbd.validate_subregion_name(subregion_name=subrgn_name)
>>> valid_name
'Birmingham'