0

I want to visualize something on a map with ggmap, this is a part of my code:

sf <- c(lon = 5.291266, lat = 52.1326332)
register_google(key = "static-maps-backend.googleapis.com") 

map <- get_map(location = sf, zoom = 14, scale = 2, maptype = c("terrain"))

But I keep getting this error :

Error in aperm.default(map, c(2, 1, 3)) : 
  invalid first argument, must be an array

So I looked it up and ran the code below

devtools::install_github("dkahle/ggmap")

After this I still got the same error as above. What can I do so this error is resolved?

mrhellmann
  • 5,069
  • 11
  • 38
  • I can't reproduce the problem. Do you have a **valid** Google Key and are you running ggmap 3.0? – Dave2e Jan 04 '20 at 20:54
  • I have the right ggmap version. The google API I"m not sure. I can't make a billing account at the moment. Does that mean I can't get the API? @Dave2e – Fleur Akkermans Jan 04 '20 at 21:13
  • 1
    Yes, you'll have to set up billing account to get an api. Check out https://developers.google.com/maps/documentation/maps-static/usage-and-billing and https://cloud.google.com/maps-platform/.. – sm925 Jan 04 '20 at 21:28
  • There is a bug in ggmap that gives this error when the API key is not valid. https://github.com/dkahle/ggmap/issues/262 – Kent Johnson Jan 05 '20 at 00:03
  • Does this answer your question? [R: Error in get\_map()/get\_googlemap() from ggmap](https://stackoverflow.com/questions/54362025/r-error-in-get-map-get-googlemap-from-ggmap) – mrhellmann Jan 05 '20 at 03:28

0 Answers0