I'm trying to call a map from google maps using ggmap. Example code:
get_googlemap(center = c(lon = -56.67, lat = 51.47), zoom = 8, size = c(640, 640), scale = 2,
format = "png8", maptype = "satellite")
However, this returns the following error:
Source : https://maps.googleapis.com/maps/api/staticmap?center=24.8,-81.7&zoom=8&size=640x640&scale=4&maptype=satellite&key=(removed key for posting)
Error in aperm.default(map, c(2, 1, 3)) :
invalid first argument, must be an array
In addition: Warning message:
In get_googlemap(center = c(lon = -81.7, lat = 24.8), zoom = 8, :
HTTP 400 Bad Request
I have looked at threads where people are experiencing similar problems. It appears they were resolved after some fiddling with the API key and restrictions. I have done the following things in that context:
- Enabled billing
- Restricted my API key - however, I am not given an option to restrict it to "Static maps". I currently have it restricted to "Google Cloud apis". Same error as before, but the key is still registering hits.
- Restarted R after doing the aforementioned things, and double checking my packages.
Would appreciate some help with this, none of my labmates are having this problem and I'm starting to tear my hair out, lol.