use*_*505 4 python offline geocoding
我正在编写一个Python脚本,它将纬度和经度传递给模块,并执行反向地理编码功能以返回该位置的地址.我一直在使用谷歌的PyGeoCoder来做这件事,但它需要访问互联网.我需要类似于PyGeoCoder的东西,但开源并完全脱机.
我创建了一个模块来完成这个:https://bitbucket.org/richardpenman/reverse_geocode
>>> import reverse_geocode
>>> coordinates = (-37.81, 144.96), (31.76, 35.21)
>>> reverse_geocode.search(coordinates)
[{'city': 'Melbourne', 'code': 'AU', 'country': 'Australia'},
{'city': 'Jerusalem', 'code': 'IL', 'country': 'Israel'}]
Run Code Online (Sandbox Code Playgroud)
在内部,它使用来自geonames数据库和kd树的位置来查找最近的邻居.