问题描述
您好,谢谢!
我是r中的ggmap()
和get_googlemap()
的新手。我想要阿拉斯加中南部的卫星图像。我的代码相当简短,并在下面共享:
ak <- map_data('worldHires','USA:Alaska')
register_google(key = "...") #key is here
ggmap::get_googlemap(center = c(mean(ak$long),mean(ak$lat)),zoom = 10,size = c(640,640),maptype = "satellite") %>%
ggmap()
我不断收到以下错误:
Error in aperm.default(map,c(2,1,3)) :
invalid first argument,must be an array
In addition: Warning message:
In ggmap::get_googlemap(center = c(mean(ak$long),:
HTTP 400 Bad Request
我已经设置了Google Api,并在运行代码时确认了匹配。我还通过https://console.cloud.google.com/启用了“ Maps Static API”。
我从github devtools::install_github("dkahle/ggmap")
下载了ggmap,并加载了库tidyverse
,mapdata
,maps
,stringr
和ggmap
。
我的数据框“ ak”的dput()
输出非常大,所以为了娱乐:
install.packages("mapdata")
library(mapdata)
ak <- map_data('worldHires','USA:Alaska')
有什么想法吗?再次谢谢你。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)