Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added get nearest postal codes #58

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

added get nearest postal codes #58

wants to merge 2 commits into from

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.

README.rst Outdated Show resolved Hide resolved
Co-authored-by: Roman Yurchak <[email protected]>
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.

None yet

2 participants