R 如何让ggmap::get_googlemap可见参数工作

R 如何让ggmap::get_googlemap可见参数工作,r,ggplot2,google-maps-api-3,ggmap,R,Ggplot2,Google Maps Api 3,Ggmap,我尝试了下面所示的方法,使用visible参数来获得比zoom提供的更精细的“get_googlemap”范围控制,但没有成功。有没有办法奏效?谢谢 library(tidyverse) library(ggmap) # static map with ggmap # boundaries of continental US # conforms to the ggmap docs bbox = c(left=-124.848974, bottom=24.396308, right = -66

我尝试了下面所示的方法,使用
visible
参数来获得比
zoom
提供的更精细的“get_googlemap”范围控制,但没有成功。有没有办法奏效?谢谢

library(tidyverse)
library(ggmap)

# static map with ggmap
# boundaries of continental US
# conforms to the ggmap docs
bbox = c(left=-124.848974, bottom=24.396308, right = -66.885444, top= 49.384358)
basemap <- get_googlemap(maptype = "roadmap", visible = as.data.frame(t(matrix(bbox,nrow=2))))
#> visible argument untested.
#> Source : https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=24.396308,-124.848974%7C49.384358,-66.885444&key=xxx-0PA

#ggmap(basemap)
# renders default Houston metro

# conforms to the ggmap docs
# the towns shown below do return valid coordinates with geocode()
basemap <- get_googlemap(maptype = "roadmap", visible = c("lubec,ME","capetown,CA"))
#> visible argument untested.
#> Source : https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=lubec,ME%7Ccapetown,CA&key=xxx-0PA

# ggmap(basemap)
# renders default Houston metro


# This is a character string which manually creates a URL similar
# to what is shown in the viewports section of the developer guide. 
# https://developers.google.com/maps/documentation/maps-static/dev-guide
# It generates the same URL as above.
basemap <- get_googlemap(maptype = "roadmap", visible = "lubec,ME%7capetown,CA")
#> visible argument untested.
#> Source : https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=lubec,ME%7capetown,CA&key=xxx-0PA

# ggmap(basemap)
# renders default Houston metro
库(tidyverse)
图书馆(ggmap)
#带有ggmap的静态映射
#美国大陆边界
#符合ggmap文档
bbox=c(左=-124.848974,下=24.396308,右=-66.885444,上=49.384358)
basemap可见参数未测试。
#>资料来源:https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=24.396308,-124.848974%7C49.384358,-66.885444&key=xxx-0PA
#ggmap(基本地图)
#呈现默认的休斯顿地铁
#符合ggmap文档
#下面显示的城镇确实返回了带有地理代码()的有效坐标
basemap可见参数未测试。
#>资料来源:https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=lubec,ME%7Ccapetown,CA&key=xxx-0PA
#ggmap(基本地图)
#呈现默认的休斯顿地铁
#这是一个字符串,可手动创建类似的URL
#显示在《开发人员指南》的“视口”部分中的内容。
# https://developers.google.com/maps/documentation/maps-static/dev-guide
#它生成与上面相同的URL。
basemap可见参数未测试。
#>资料来源:https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=10&size=640x640&scale=2&maptype=roadmap&visible=lubec,ME%7capetown,CA&key=xxx-0PA
#ggmap(基本地图)
#呈现默认的休斯顿地铁