Closed synrg closed 5 years ago
Discussing it some more, we checked the distance before/after this patch and it checks out fine. Distance is the same with & without the normalization. The problem is the formula itself does not work well at the poles due to distortion in the Mercator projection. So for Adelie Penguin, for instance, the distance is calculated at near 2000km and the zoom factor set too high (5, instead of 2 or 3) so you can barely see any of the range.
This answer looks like a promising alternative to our algorithm that considers the distortion at the poles:
Compare these two images. The first is a map for https://inaturalist.ca/taxa/460811-Eupeodes-americanus as produced by the
inat map
command, and the 2nd is a map at the same window size for the same species as found on the Map tab on the web:Clearly our center point and zoom factor leave something to be desired, as none of the actual range of the species are in view. So, generally speaking, our algorithm produces a zoom factor is too high, and picking the midpoint of the rectangle returned by
get_observations()
withreturn_bounds = true
yields poor results when a species appears on multiple continents.First, we should look at the code that generates the map for the web, and see if we can emulate what they do.
Second, if we're still not happy with the results a straight port of their code into ours gives us, we should discuss with the developers how to improve the algorithm, vs. coming up with something on our own.