gpt4 book ai didi

python - Python中的离线反向地理编码

转载 作者:行者123 更新时间:2023-12-04 22:21:14 26 4
gpt4 key购买 nike

我正在编写一个 Python 脚本,它将纬度和经度传递给模块并执行反向地理编码功能以返回该位置的地址。我一直在使用 Google 的 PyGeoCoder 来执行此操作,但它需要访问 Internet。我需要类似于 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'}]

在内部,它使用 geonames 数据库中的位置和 k-d 树来查找最近的邻居。

关于python - Python中的离线反向地理编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18803509/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com