If a Mapillary response contains only images that have already been previously selected, get_image_from_coordinates won't return prematurely due to an empty response. Instead, it continues to the for loop but then this filtered list is empty, leaving closest as 0 and closest_distance as infinity. It won't raise an error, but it will return arbitrarily the first image, which has already been previously selected, and with the wrong distance calculation.
Simple fix would be to do the filter for previous selection before the check for an empty response.
If a Mapillary response contains only images that have already been previously selected,
get_image_from_coordinates
won't return prematurely due to an empty response. Instead, it continues to the for loop but then this filtered list is empty, leavingclosest
as 0 andclosest_distance
as infinity. It won't raise an error, but it will return arbitrarily the first image, which has already been previously selected, and with the wrong distance calculation.Simple fix would be to do the filter for previous selection before the check for an empty response.