Add Legend to map
This commit is contained in:
11
server.R
11
server.R
@@ -41,6 +41,9 @@ server <- function(input, output, session) {
|
||||
mapproxy <- leafletProxy("hhmap")
|
||||
clearGroup(mapproxy, "selected")
|
||||
clearGroup(mapproxy, "layer_heatmap")
|
||||
# Entfernt eine eventuell existierende Legende vom vorherigen Durchlauf
|
||||
removeControl(mapproxy, "heatmap_legend")
|
||||
|
||||
if (heatmap != "") {
|
||||
hideGroup(mapproxy, "layer_bezirke")
|
||||
hideGroup(mapproxy, "layer_stadtteile")
|
||||
@@ -68,6 +71,14 @@ server <- function(input, output, session) {
|
||||
weight = 3,
|
||||
fillOpacity = 0.8
|
||||
)
|
||||
# Legende hinzufügen
|
||||
addLegend(mapproxy,
|
||||
pal = pal,
|
||||
values = heatmap_polygons$intensity,
|
||||
title = paste("Intensität:", heatmap),
|
||||
position = "bottomright",
|
||||
layerId = "heatmap_legend" # Wichtig zum gezielten Entfernen
|
||||
)
|
||||
#---------------------
|
||||
} else {
|
||||
if (maptype == "Bezirke"){
|
||||
|
||||
Reference in New Issue
Block a user