GeofabrikDownloader.validate_file_format¶
- GeofabrikDownloader.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 to a filename extension available on Geofabrik free download server.
- Parameters:
osm_file_format (str) – file format/extension of the OSM data on the free download server
valid_formats (Iterable) – 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 toTruekwargs – [optional] parameters of pyhelpers.text.find_similar_str()
- Returns:
formal file format
- Return type:
str
Examples:
>>> from pydriosm.downloader import GeofabrikDownloader >>> gfd = GeofabrikDownloader() >>> osm_file_format = ".pbf" >>> gfd.validate_file_format(osm_file_format) '.osm.pbf' >>> osm_file_format = "shp" >>> gfd.validate_file_format(osm_file_format) '.shp.zip' >>> osm_file_format = "geopackage" >>> gfd.validate_file_format(osm_file_format) '.gpkg.zip'