我正在使用Leaflet作为我的RShiny App的映射和标记群集服务。由于R的传单包没有标记聚类功能(https://github.com/Leaflet/Leaflet.markercluster),我必须将其作为附加插件导入:
registerPlugin <- function(map, plugin) {
map$dependencies <- c(map$dependencies, list(plugin))
map
}
clusterPlugin<-htmlDependency("Leaflet.markercluster", "1.0.0",
src = c(href = "https://github.com/Leaflet/Leaflet.markercluster/tree/master/build"),
script = "build.js"
)
output$map <- renderLeaflet({
(leaflet() %>% setView(lng = 10.23, lat = 50.18, zoom = 5)) %>%
addTiles()%>%
setView(10.23, 50.18, zoom = 5) %>%
registerPlugin(clusterPlugin) %>%
addMarkers(alldata$Longitude, alldata$Latitude, clusterOptions = markerClusterOptions())
})
我的问题是,如何在突出显示的群集中提取标记的数量和名称等信息?如何在不使用专用软件包的情况下使用R与JavaScript进行通信?我正在考虑在群集上右键单击以查看可能的选项。