2

I am running the following Code:

map <- get_map(location = 'India', zoom = 4)

But getting following error:

Source : https://maps.googleapis.com/maps/api/staticmap?center=India&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&key=XXXXXX Error in aperm.default(map, c(2, 1, 3)) : invalid first argument, must be an array

In addition: Warning message:

In get_googlemap(center = location, zoom = zoom, maptype = maptype, : HTTP 400 Bad Request

devios1
  • 36,899
  • 45
  • 162
  • 260

1 Answers1

4

Faced the same issue. I fixed it, using latitude and longitude for the location. I used 4 coordinates to locate the location. The following code shows an illustration of how you can fix this issue.

usa <- c(left = -125, bottom = 25.75, right = -67, top = 49)
get_map(usa, zoom = 4, maptype = "terrain") %>%
ggmap()

Please note: If you are trying to reproduce the above code snippet. It requires "dplyr" and "ggmap" to be installed. For a step by step tutorial on how to use ggmap. click here.

Azametzin
  • 5,223
  • 12
  • 28
  • 46
Shrivathsa
  • 91
  • 6