我的googleway
软件包具有谷歌地图小部件,并且还可以与Shiny配合使用。
您需要有效的Google API密钥才能使用它
library(googleway)
key <- "your_api_key"
df <- data.frame(lat = -37.817714,
lon = 144.967260,
info = "Flinders Street Station")
google_map(key = key, height = 600, search_box = T) %>%
add_markers(data = df, info_window = "info")
卫星图
![enter image description here](https://istack.dev59.com/Dza8M.webp)
卫星图/街景
![enter image description here](https://istack.dev59.com/twRmR.webp)
街景图
(请注意标记仍然存在)
![enter image description here](https://istack.dev59.com/xtUVL.webp)
更新 - 静态街景地图
还有一个google_streetview()
函数,可以下载静态街景图像(使用Google Street View Static Image API)
google_streetview(location = c(-37.8177, 144.967),
size = c(400,400),
panorama_id = NULL,
output = "plot",
heading = 90,
fov = 90,
pitch = 0,
response_check = FALSE,
key = key)
![enter image description here](https://istack.dev59.com/qg9Br.webp)
ggmap
很有用,因为你可以在地图上添加内容,但是 Streetview 提供的图像实际上无法在其上绘制。如果没有答案,我建议编写访问 API 的函数。 - Jonathan Carroll