使用python从给定坐标获取地址

问题描述 投票:0回答:1

我有一些经度,纬度,我想使用python转换为特定地址。你知道怎么做吗?谢谢。

python coordinates street-address
1个回答
0
投票

您所说的方法称为反向地理编码。您可以使用Nominatim(OSM)来获得免费的地理编码服务

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="specify_your_app_name_here")
location = geolocator.reverse("52.509669, 13.376294")
print(location.address)

或者,如果您想获得更好的结果,则可以使用需要API密钥的Google Geocode服务

from geopy.geocoders import GoogleV3
geolocator = GoogleV3(api_key='Your_API_Key')
location = geolocator.reverse("52.509669, 13.376294")
print(location.address)
© www.soinside.com 2019 - 2024. All rights reserved.