This past summer I was working on a code in R where I used the packages mapview
and ggmap
. During the summer the code was working fine. This past week I ran the code without any changes and I get the following message when I use mapview
:
mapview(as(tr10, "Spatial"), zcol = "utc_timestamp", lwd = 5,
legend = TRUE)
Error in htmlwidgets::sizingPolicy(defaultWidth = defaultWidth, defaultHeight = defaultHeight, :
unused argument (browser.external = FALSE)
I did not made any changes to my code and I upgrade the package just in case but still does not work. And with ggmap
I get the following:
puerto_rico <- get_map(location = c(lon = mean(long), lat = mean(lat)),
maptype = "terrain", source = "google",
zoom = 12)
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=18.2,-67.1&zoom=12&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message:
In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=18.2,-67.1&zoom=12&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'
Can someone explain what is happening with these packages and what other alternatives do I have for me to access the use of maps for my plots?
Google has tightened controls on API access to Google Map products. This means that you now need a Google API key to use ggmap().
There are a few steps involved:
register_google("<your API key>")
. You will need to run this
for every new session in which you will use ggmap(). I have added it to my .Rprofile.Good luck!