一段时间后我再次开始使用该包ggmap,现在当我尝试使用 function 获取地图时遇到问题get_map。无论我指定哪个来源,我总是收到错误
Error: Google now requires an API key.
See ?register_google for details.
Run Code Online (Sandbox Code Playgroud)
虽然我不知道为什么这样的电话
get_map(location = "texas", zoom = 6, source = "stamen")
Run Code Online (Sandbox Code Playgroud)
需要对谷歌进行 API 调用。有没有人经历过类似的事情并且有已知的解决方法吗?
小智 3
正如 @camille 指出的,这可以通过提供 bbox 对象来解决,我们可以使用 package {osmdata}、 functiongetbb()
在你的情况下,它将是:
pacman::p_load(ggmap, osmdata)
get_map(location = getbb("texas"), zoom = 6, source = "stamen")
Run Code Online (Sandbox Code Playgroud)
结论:
无需创建 google API 密钥即可从 google 地图或 openstreet 地图检索底图。希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
6958 次 |
| 最近记录: |