0

The code below works on my personal laptop but not on my work laptop.

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")

When I run the code on my work laptop I get this result:

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)')))

Basically, I would like to loop through a bunch of addresses in a dataframe and concatenate the latitude and longitude coordinates to each address (add two columns, per row, to the dataframe). How can I do that using a free service (maybe GeoPy, maybe Google Maps, etc.).

ASH
  • 20,759
  • 19
  • 87
  • 200
  • Your work laptop may have settings that prevent SSL from working. Have you tried going to `https://nominatim.openstreetmap.org` on a browser on your work laptop? If that results in an SSL error then that will confirm the issue. If not, then you will need to install the correct SSL certificates onto your work laptop, like you did for your personal laptop, though your employer may have restricted this ability due to file permissions. – metatoaster Mar 30 '23 at 02:51

1 Answers1

-1

I'm guessing that the terminal that is running this on your work laptop isn't configured with an https proxy to match your work's settings, which causes your terminal to not have connection to the internet. You can verify this by trying to ping www.google.com for example and seeing that you won't get any replies. I'd suggest contacting your local IT to help you solve this issue.

TheTomer
  • 143
  • 3
  • 11
  • 1
    Why would the geocode lookup work fine but the reverse lookup fail to connect to the internet? – Pranav Hosangadi Mar 30 '23 at 00:56
  • I tried all the suggestions from the three links posted about an hour ago. Nothing has worked for me so far. When I ran the 'install_certifi.py' file, I got this error. Traceback (most recent call last): File "C:\Users\RShuell\AppData\Local\Temp\1\ipykernel_2920\2095152182.py", line 38, in main() File "C:\Users\RShuell\AppData\Local\Temp\1\ipykernel_2920\2095152182.py", line 24, in main os.chdir(openssl_dir) FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Program Files\\Common Files\\ssl' – ASH Mar 30 '23 at 02:26