BBBikeDownloader.validate_file_format

BBBikeDownloader.validate_file_format(osm_file_format, valid_formats=None, raise_error=True, **kwargs)[source]

Validate an input file format of OSM data.

The validation is done by matching the input osm_file_format to a filename extension available on BBBike free download server.

Parameters:
  • osm_file_format (str) – file format/extension of the OSM data available on BBBike free download server

  • valid_formats (Collection | None) – fil extensions of the data available on a free download server

  • raise_error (bool) – (if the input fails to match a valid name) whether to raise the error pydriosm.downloader.InvalidFileFormatError, defaults to True

Returns:

valid file format (file extension)

Return type:

str

Examples:

>>> from pydriosm.downloader import BBBikeDownloader
>>> bbd = BBBikeDownloader()
>>> osm_file_format_ = bbd.validate_file_format(osm_file_format='PBF')
>>> osm_file_format_
'.pbf'
>>> osm_file_format_ = bbd.validate_file_format(osm_file_format='.osm.pbf')
>>> osm_file_format_
'.pbf'