Conversation
There was a problem hiding this comment.
THanks @eracle!
Actually thinking more about this, I don't think that KDTree would be correct for this use case because it uses Euclidean distance. The correct distance to use for GPS coordinates, is haversine_distance also included in the package. So let's rather do brute-force calculations with that distance. The Euclidean distance might provide reasonably good results when the query point is near the postal code in question, however it will give completely wrong results near the 180th meridian (where there longitude would switch between +180 and -180) or near the poles.
Also I was thinking we could add this rather as a method Nominatim().query_latitude_longutude or some other name starting with query rather than having a separate class.
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
Hello guys, as discussed in #7 here's a PR that allows retrieving the nearest postal codes.
It uses KDTree from scipy.
Let me know