r - How do I update the centre value for get_googlemap in the ggmap package?
问题描述
I am trying to obtain a map of a part of London (England) using the ggmap package in R, coordinates -0.205, 51.516. However, when obtaining/plotting the map, the centre constantly defaults to 29.763284,-95.36327 (somewhere in Houston, Texas). For example, see the structure of the link below - nb: it's not navigable without a valid API key.
I've tried to use alternative coordinates but the result is always the same. Have also tried to use an alternative API keys to no avail. My stripped down code is as follows:
library(ggmap)
register_google(key = "[my API key]")
has_google_key()
test <- get_googlemap(location = c(lon=-0.205, lat=51.516),
zoom = 16, maptype = "satellite",color="bw")
ggmap(test)
The expected result is that centre will update to -0.205, 51.516 and show a portion of Portobello Road as a black and white Satellite Google map tile. Suggestions and comments are most welcome - go easy, I'm new here! Apologies if this question has already been asked/addressed.
解决方案
我认为应该center
代替location
.
test <- get_googlemap(center = c(lon=-0.205, lat=51.516),
zoom = 16, maptype = "satellite",color="bw")
默认值为center = c(lon = -95.3632715, lat = 29.7632836)
,即休斯顿市中心。
推荐阅读
- css - 嵌套的 onHover 选择器不适用于样式化组件
- javascript - 从另一个页面刷新一个php页面
- office-js - 如何在 Word JS 加载项中检测 Windows 10 和 Office 365 版本
- python - 当我使用 end 参数时,为什么 python print() 函数会在行尾打印一个 % ?
- spring-boot - X509认证的管理端口和服务器端口
- zip - 如何调用返回 zip 文件的 API 并将 zip 存储到本地
- docker - 如何在不通过 jupyter notebook 运行的 docker 映像中定义设置
- javascript - createAsyncThunk:中止先前的请求
- java - 错误:无法找到或加载主类 org.apache.maven.wrapper.MavenWrapperMain 和 ClassnotFound 异常
- java - 如何在一定范围内加减