2

G'day,

I am trying to learn how to use the ggmap package in R, but am getting stuck at the very beginning. All I am trying to do is use the qmap() function to download maps, but I am getting some very strange results. I have tried:

library(ggmap)
aus<- qmap('australia')
aus<- qmap('australia', zoom = 5)

and number of other locations and things. Sometimes a map is downloaded, but more often than not I get the following error message:

Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb"): 
  cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=adelaide&zoom=6&size=%20640x640&scale=%202&maptype=terrain&sensor=false'
In addition: Warning message:
In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :
  cannot open: HTTP status was '403 Forbidden' 

It will work correctly one time then 5 secs later when I try it again with the exact some code it wont work.

From repeatedly using this function it seems like there is a time delay between its successful use. I have timed how long I have to wait between between successful uses, and it seems that 1 min is this thresh-hold. Also, every time I try to use the function, whether it is successful or not, it resets this 1 minute waiting time.

Do places like google restrict how often you can download stuff? This is a little frustrating if I want to quickly check if a map is the appropriate size, etc. Has anyone had the same experience, know what I might be doing wrong, or know a way around this issue?

Thanks in advance for your time and help!

Cheers, Adam

Adam
  • 1,147
  • 3
  • 15
  • 23
  • 1
    the issue could simply be with the google api. Although for what it's worth, I just ran the small snippet you provided 10~15 times without any issue. Did you try to copy+paste the URL into your browser? It looks like it is just a small portion of the map you are downloading – Ricardo Saporta Dec 10 '12 at 07:31
  • Gday Ricardo, yep I did try pasting it into the browser and it didnt work. It would say something about the source not being specified correctly or something. I will have to check out the api thing you mention and see whether that is restricting me. Also, it is only a small section of the map because i havent specified a larger range. Cheers – Adam Dec 10 '12 at 08:50
  • This problem only occurs when I am using my mobile as a wireless hotsopt... I don't really know what's going on, but not too much of a problem as long as I use proper internet! – Adam May 07 '13 at 07:04
  • well there you have it! ;) – Ricardo Saporta May 07 '13 at 13:15

0 Answers0