in src/mapillary/models/api/vector_tiles.py [0:0]
def __zoom_range_check(self, layer: str, zoom: int):
"""
Checks for the correct zoom values for te specified layer
:param layer: Either 'overview', 'sequence', 'image', or 'map'
:type layer: str
:param zoom: The zoom levels,
:type zoom: int
:raises InvalidOptionError: Invalid option passed
:return: A GeoJSON for the return object
:rtype: dict
"""
# If zoom is not in the valid range of values
if zoom < self.__min_zoom or zoom > self.__max_zoom:
# Raise an exception for the invalid values passed
raise InvalidOptionError(
# Parameters accordingly
param="zoom",
value=zoom,
options=[_ for _ in range(self.__min_zoom, self.__max_zoom + 1)],
)
# If layer was specified to be 'overview'
if layer == "overview":
# If zoom is not in the given range of values
if zoom not in [_ for _ in range(self.__min_zoom, 5 + 1)]:
# Raise an exception for the invalid zoom value
raise InvalidOptionError(
# Parameters accordingly
param="zoom",
value=zoom,
options=[_ for _ in range(self.__min_zoom, 5 + 1)],
)
# If layer was specified to be 'sequence'
elif layer == "sequence":
# IF zoom not in the given range of values
if zoom not in [_ for _ in range(6, 14 + 1)]:
# Raise an exception for the invalid zoom value
raise InvalidOptionError(
# Parameters accordingly
param="zoom",
value=zoom,
options=[_ for _ in range(6, 14 + 1)],
)
# If layer was specified to be 'image' or 'map'
elif layer == "image" or layer == "map_feature" or layer == "traffic_sign":
# If zoom was not 14
if zoom != 14:
# Raise an exception for the invalid zoom value
raise InvalidOptionError(param="zoom", value=zoom, options=[14])
# Else, an invalid layer string was passed
else:
# Raise a InvalidOptionError
raise InvalidOptionError(
# Parameters accordingly
param="layer",
value=layer,
options=["overview", "sequence", "image"],
)