I am attempting to geocode addresses in R
using the geocode()
function in the ggmap
package. I have done this on my personal computer relatively easily and want to attempt this on my work computer. Generally, I am supposed to register with Google, library the ggmap
package, read-in my security key, and then I can use the geocode()
function. But I get errors. See below:
# Library package
library(ggmap)
# Set key file
gmAPI <- "key_file.txt"
# Read-in Google API key
gmAPIKey <- readLines(gmAPI)[1]
# Register key
register_google(key = gmAPIKey)
# Geocode Waco, TX
geocode("waco, texas", output = "latlona")
Instead of generating geocoded output, I receive:
Source : https://maps.googleapis.com/maps/api/geocode/json?address=waco,+texas&key=xxx.txt
Error in curl::curl_fetch_memory(url, handle = handle) :
Failed to connect to maps.googleapis.com port 443: Timed out
or sometimes:
Source : https://maps.googleapis.com/maps/api/geocode/json?address=waco,+texas&key=xxx.txt
Error in curl::curl_fetch_memory(url, handle = handle) :
Failed to connect to url port ###: Connection refused
Note: I replaced the actual url/port posted in the error message with url port ###
as I imagine this is specific to my computer.
I have a feeling this has to do with my work network. Similar questions have set some configuration using the httr
package, but those solutions have not worked for me. It's possible I am entering the wrong information. Any help?