【问题标题】:Gather markers by clusters using R googlemap package使用 R googlemap 包按集群收集标记
【发布时间】:2018-09-15 18:04:37
【问题描述】:

如何在 R 中使用 googleway 包对 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)

非常感谢

【问题讨论】:

    标签: r google-maps maps google-maps-markers googleway


    【解决方案1】:

    A bug 在 CRAN 上的最新版本 (v2.4) 中发现,它破坏了集群。

    我在开发版 (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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-24
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多