in src/mapillary/utils/filter.py [0:0]
def is_looking_at(image_feature: Feature, look_at_feature: Feature) -> bool:
"""
Return whether the image_feature is looking at the look_at_feature
:param image_feature: The feature set of the image
:type image_feature: dict
:param look_at_feature: The feature that is being looked at
:type look_at_feature: dict
:return: Whether the diff is greater than 310, or less than 50
:rtype: bool
"""
# Pano accessible via the `get_image_layer`
# in config/api/vector_tiles.py
if image_feature["properties"]["is_pano"]:
return True
# Compass angle accessible via the `get_image_layer`
# in config/api/vector_tiles.py
if image_feature["properties"]["compass_angle"] < 0:
return False
# Getting the difference between the two provided GeoJSONs and the compass angle
diff: int = (
abs(
bearing(start=image_feature, end=look_at_feature)
- image_feature["properties"]["compass_angle"]
)
% 360
)
# If diff > 310 OR diff < 50
return 310 < diff or diff < 50