我正在嘗試使用RgoogleMaps製作地圖。用我的代碼今天早上上班,但現在我得到這個錯誤:程序包「RgoogleMaps」HTTP狀態爲'403 Forbidden'錯誤
map.lyon <- GetMap(center=c(45.77338,4.856039), zoom = 15, destfile = "tile1.png", maptype = "mobile")
Error in download.file(url, destfile, mode = "wb", quiet = TRUE) :
cannot open URL 'http://maps.google.com/maps/api/staticmap?center=45.77338,4.856039&zoom=15&size=640x640&maptype=mobile&format=png32&sensor=true'
In addition: Warning message:
In download.file(url, destfile, mode = "wb", quiet = TRUE) :
cannot open: HTTP status was '403 Forbidden'
我今天早上(也許200),有沒有在谷歌地圖API的請求的限制做了很多的地圖?
我也嘗試使用OpenStreetMaps代替Google Maps,總是使用RgoogleMaps包,但這也不起作用(雖然它只是網站上的代碼的簡單示例),但錯誤非常相似,下面是代碼:
library(RgoogleMaps)
lat_c<-51.47393
lon_c<-7.22667
bb<-qbbox(lat = c(lat_c[1]+0.01, lat_c[1]-0.01), lon = c(lon_c[1]+0.03, lon_c[1]-0.03))
OSM.map<-GetMap.OSM(lonR=bb$lonR, latR=bb$latR, scale = 20000, destfile="bochum.png")
這裏是我,當我運行它:
> library(RgoogleMaps)
> lat_c<-51.47393
> lon_c<-7.22667
> bb<-qbbox(lat = c(lat_c[1]+0.01, lat_c[1]-0.01), lon = c(lon_c[1]+0.03, lon_c[1]-0.03))
> OSM.map<-GetMap.OSM(lonR=bb$lonR, latR=bb$latR, scale = 20000, destfile="bochum.png")
[1] "http://tile.openstreetmap.org/cgi-bin/export?bbox=7.19637,51.46383,7.25697,51.48403&scale=20000&format=png"
trying URL 'http://tile.openstreetmap.org/cgi-bin/export?bbox=7.19637,51.46383,7.25697,51.48403&scale=20000&format=png'
Error in download.file(url, destfile, mode = "wb", quiet = FALSE) :
cannot open URL 'http://tile.openstreetmap.org/cgi-bin/export?bbox=7.19637,51.46383,7.25697,51.48403&scale=20000&format=png'
In addition: Warning message:
In download.file(url, destfile, mode = "wb", quiet = FALSE) :
cannot open: HTTP status was '403 Forbidden'
我不明白是什麼問題。有我可以使用的另一個包嗎?基本上我只需要在該地區有主要城市和道路的背景地圖,並能夠在上面繪製點。
謝謝你的時間。
謝謝,ggmap沒有錯誤! – fmarm