Geopy返回HTTP错误400:请求错误

2024-03-28 08:20:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用geopy包获取位置地理代码,但总是运行到HTTP Error 400: Bad Request

以下是我的代码,在正式文件https://geopy.readthedocs.io/en/stable/之后:

from geopy.geocoders import ArcGIS
geolocator = ArcGIS(scheme="http")
loc_home = geolocator.geocode("175 5th Avenue NYC")

以下是错误:

geopy.exc.GeocoderQueryError: HTTP Error 400: Bad Request

请提前帮助和感谢


Tags: 文件代码httpsiohttprequestreadthedocserror
1条回答
网友
1楼 · 发布于 2024-03-28 08:20:50

您需要使用https方案,我猜http被ArcGIS阻止了

from geopy.geocoders import ArcGIS
geolocator = ArcGIS(scheme="https")

geolocator.geocode("175 5th Avenue NYC")

#Location(175 5th Ave, New York, 10010, (40.741110006692395, -73.98968797828522, 0.0))

相关问题 更多 >