如何使用googleway
包在R中的Google地图中聚类标记?
我尝试使用add_markers选项(“cluster = TRUE”)但没有成功
这是一个可重现的例子和我得到的地图:
library(googleway)
key <- "my_google_map_API"
df <- data.frame(
lat = c(45.77740319999999,45.77740319999999,46.77740319999999,46.77740319999999),
lon = c(4.855214400000023,4.955214400000023,4.855214400000023,4.955214400000023))
google_map(key = key, height = 600, search_box = T) %>%
add_markers(data = df,cluster = TRUE)
非常感谢
答案 0 :(得分:1)
A bug,这打破了集群。
我在开发版本(v2.5 +)中发布了一个修复程序,您可以使用
进行安装# library(devtools)
devtools::install_github("SymbolixAU/googleway")
然后它应该工作。
library(googleway)
key <- "map_key"
df <- data.frame(
lat = c(45.77740319999999,45.77740319999999,46.77740319999999,46.77740319999999),
lon = c(4.855214400000023,4.955214400000023,4.855214400000023,4.955214400000023)
)
google_map(key = key, height = 600, search_box = T) %>%
add_markers(data = df,cluster = TRUE)