How to forward geocode in Python without Internet connection from scripts?

I have addresses I want to convert into latitudes and longitudes. I do not have admin rights on my computer, so Python scripts cannot connect to the geocoding APIs (ie Google, Nominatim, etc.). I have tried the geocoding packages available on PyPi.

Do you all know of any alternative to connecting directly to the API? Is there anyway to do offline geocoding? I have seen packages for offline reverse geocoding, but not for forward geocoding. Logically, the only option I can think of is to download the data en masse and compare locally. I'm not sure the feasibility of that though.

Any thoughts are appreciated!


geopy could be what you want.

>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim()
>>> location = geolocator.geocode('1327 Harding Place, Charlotte, North Caroline')
>>> location.latitude, location.longitude
(35.2082683450311, -80.8377261377877)

Available at https://github.com/geopy/geopy or http://www.lfd.uci.edu/~gohlke/pythonlibs/ if the laptop runs Windows.

EDIT: I just saw your last comment. Copy the .whl file that downloads from that second link (assuming you're running Windows) to a CD or DVD and install from that.

链接地址: http://www.djcxy.com/p/63630.html

上一篇: 我怎样才能得到一个严格的accumArray?

下一篇: 如何在没有Internet连接的情况下使用Python转发地理编码?