AmericanRedCross / street-view-green-view

BSD 3-Clause "New" or "Revised" License
15 stars 15 forks source link

unhandled edge case in image selection #40

Closed jchboettcher closed 3 months ago

jchboettcher commented 4 months ago

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.