Skip to content

added get nearest postal codes#58

Open
eracle wants to merge 2 commits intosymerio:mainfrom
eracle:main
Open

added get nearest postal codes#58
eracle wants to merge 2 commits intosymerio:mainfrom
eracle:main

Conversation

@eracle
Copy link

@eracle eracle commented Mar 10, 2022

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

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants