Jump to content
Ornithology Exchange
partifecske

map.FLightR.ggmap error

Recommended Posts

Hi,

During the last days, I tried to use the map.FLightR.ggmap() and plot_util_distr() function, however the I've received the next error message:

Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") : 
  cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=28.35,19.851456&zoom=2&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=28.35,19.851456&zoom=2&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'

Can you help me to solve this problem?

Tibor Szép

Hungary
 

Share this post


Link to post
Share on other sites

Hello partifecske, unfortunately I do not have an answer for you, I just wanted to add a very similar / the same (?) error I have recently been getting in the hope there will be an answer for both of us.

> map.FLightR.ggmap(Result)

Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :

  cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=34.65,-8.191707&zoom=2&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") :

  InternetOpenUrl failed: 'The server name or address could not be resolved'

 

Share this post


Link to post
Share on other sites

  Unfortunately this results of the new google rules for use of google maps. They want everyone to get the api key for google maps. In order to do this you should

1. go to https://cloud.google.com/maps-platform/?apis=maps

get the key there

2. update you ggmap 

devtools::install_github("dkahle/ggmap")

3. then in each session in R try 

ggmap::register_google('your_api_key')

Now FLightR ggmap related functions should work.

Share this post


Link to post
Share on other sites

I went around the block with google maps for a couple of hours and could not get past this cryptic error message when trying to download a simple example map:

ggmap::register_google(key = APIkey)
map <- get_map(location = "texas", zoom = 6, source = "stamen")

Source : https://maps.googleapis.com/maps/api/staticmap?center=texas&zoom=6&size=640x640&scale=2&maptype=terrain&key=xxx
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, filename = filename) :
  HTTP 400 Bad Request

Others have had this issue and some have solved it--there are some suggestions on stackoverflow--but not me. I tried a bunch of enabling and management options for static maps API, but nothing worked. Maybe something has changed recently with google or ggmap??

Anyway, I'm now building my maps from scratch using get_stamenmap(). Might be a better future option for map.FLightR.ggmap().

Share this post


Link to post
Share on other sites

  Hi Eli,

 Everything works for me at the moment, but after updating R  and ggmap to the newest versions. 

 Stamenmaps also fail a lot, and thus are hard to use within a function. I will wait for something more reliable before changing a function myself, but everyone is welcome to write a map_FLightR_stamenmap() 

  Cheers,

    Eldar

Share this post


Link to post
Share on other sites

×
×
  • Create New...