GetMap.bbox() error

Hello everyone!
I have an error message using the function GetMap.bbox(). I have specified my API_key, but still I can't download the map.

terrmap <- GetMap.bbox(lonR = c(min(df3$lon)-1, max(df3$lon)+1), latR = c(min(df3$lat)-1, max(df3$lat)+1),maptype= "terrain", destfile = "terrain.png", MINIMUMSIZE = F, NEWMAP = T, API_console_key = Sys.getenv("AIzaSyBXkxxxxxxxx"))

I get back this:

[1] "API key provided"
Error in download.file(urlStr, destfile, mode = "wb", quiet = TRUE) :
cannot open URL ',15.591801&zoom=5&size=640x640&maptype=terrain&format=png32&sensor=true&key='
In addition: Warning message:
In download.file(urlStr, destfile, mode = "wb", quiet = TRUE) :
cannot open URL ',15.591801&zoom=5&size=640x640&maptype=terrain&format=png32&sensor=true&key=': HTTP status was '403 Forbidden'

Can you please help me? Thank you very much.

Solved already. Just after I asked... I will write it here in case that someone will be having the same problem. The problem was that I didn't enable the services 'Maps Static API' and 'Maps Embed API' in my project on the Google Cloud. Here is a link that helped me: The Google Maps API server rejected your request - Stack Overflow

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.