Live data from Hacker News

A fast, offline reverse geocoder in Python

github.com

41–46 of 46 posts

Re: A fast, offline reverse geocoder in Python

#41

This is great, does anyone know of a js version? I'm currently using http://nominatim.openstreetmap.org/reverse in my Node app but I'd rather not rely on a 3rd party, especially under heavy load.

Check out this library for Node https://github.com/tomayac/local-reverse-geocoder

Thanks for posting this. Would appreciate pull requests and feature requests or simply general feedback if you use this in practice.

Re: A fast, offline reverse geocoder in Python

#42
post #27

You can't really use KD trees with lat/lon coordinates, at least you can't use euclidean distance there for nearest neighbor search. First, longitude wraps from -180 to +180 at antimeridian, meaning distance calculations will fail there; second, and I'd say more importantly, one degree longitude length in meters differs a lot depending on latitude; meaning this library will be heavily biased towards longitudal neighb…

I can recommend the excellent Geographic lib::Geodesic for this having used it in the past. http://geographiclib.sourceforge.net There is a python implementation available as well. http://pypi.python.org/pypi/geographiclib

Thanks!

Re: A fast, offline reverse geocoder in Python

#43
post #26

Earlier quoted context omitted.

Thanks for that comment! Good question regarding the license. I'm not too sure about that. I'd appreciate it if someone could shed some light on it. Regarding the version, I've only tested it on python2. I should add that in the README. Thanks!

As of now, for Python 3 it does not work, but it seams that fixes are not hard: https://github.com/thampiman/reverse-geocoder/issues/2

UPDATE: I've just released v1.2 which supports Python 3. For details: https://github.com/thampiman/reverse-geocoder

Re: A fast, offline reverse geocoder in Python

#44
post #27

You can't really use KD trees with lat/lon coordinates, at least you can't use euclidean distance there for nearest neighbor search. First, longitude wraps from -180 to +180 at antimeridian, meaning distance calculations will fail there; second, and I'd say more importantly, one degree longitude length in meters differs a lot depending on latitude; meaning this library will be heavily biased towards longitudal neighb…

I've fixed this by converting the geodetic coordinates to ECEF. See v1.2 release notes here: https://github.com/thampiman/reverse-geocoder

Re: A fast, offline reverse geocoder in Python

#45
post #26

Earlier quoted context omitted.

As of now, for Python 3 it does not work, but it seams that fixes are not hard: https://github.com/thampiman/reverse-geocoder/issues/2

UPDATE: I've just released v1.2 which supports Python 3. For details: https://github.com/thampiman/reverse-geocoder

Sweet!

Re: A fast, offline reverse geocoder in Python

#46
post #31

While we're on this subject, is there a good, free street address parser that will work for at least the US, Canada, UK, and the major EU countries? I've tried most of the available ones, and they can parse about 90-95% of business addresses. (Regular expressions don't work well for this. Neither does starting from the beginning of the address. Proper address parsing starts at the end of the address and works backwar…

Have you tried Nominatim? I've found it to work for most of the above. I'm only disappointed it doesn't work well for developing countries, particularly a lot of Asia.
Post reply on HN