python-3.x 如何从街道地址中获取经纬度?[重复]

e0bqpujr  于 2023-03-31  发布在  Python
关注(0)|答案(1)|浏览(171)

此问题在此处已有答案

Getting [SSL: CERTIFICATE_VERIFY_FAILED] error when trying to run geocoder in geopy how can I verify the certificate to get needed output?(2个答案)
SSLCertVerificationError - Geopy - unable to get local issuer certificate (_ssl.c:1108)(1个答案)
My geopy.geocoders is throwing error: SSL: CERTIFICATE_VERIFY_FAILED. How can I resolve this? [duplicate]
昨天关门了。
社区正在审查是否从昨天开始重新讨论这个问题。
下面的代码可以在我的个人笔记本电脑上工作,但不能在我的工作笔记本电脑上工作。

import pandas as pd
import folium
import geopy
from geopy.geocoders import Nominatim

# Geocoding
geolocator = Nominatim(user_agent="myGeolocator")
location = geolocator.geocode("225 Baker St NW, Atlanta, GA 30313, United States")
location.raw

# Reverse Geocoding
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="myGeolocator")
location = geolocator.reverse("33.76326745, -84.39511726814364")

当我在我的工作笔记本电脑上运行代码时,我得到这样的结果:

GeocoderUnavailable: HTTPSConnectionPool(host='nominatim.openstreetmap.org', port=443): Max retries exceeded with url: /reverse?lat=33.76326745&lon=-84.39511726814364&format=json&addressdetails=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))

基本上,我想在一个 Dataframe 中循环一堆地址,并将纬度和经度坐标连接到每个地址(每行添加两列到 Dataframe )。我如何使用免费服务(可能是GeoPy,可能是Google Maps等)来完成这一点。

7jmck4yq

7jmck4yq1#

我猜在你的工作笔记本电脑上运行这个的终端没有配置https代理来匹配你的工作设置,这导致你的终端没有连接到互联网。你可以通过尝试ping www.google.com来验证这一点,例如,看到你不会得到任何回复。我建议联系你当地的IT来帮助你解决这个问题。

相关问题