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")
|
mapproxy <- leafletProxy("hhmap")
|
||||||
clearGroup(mapproxy, "selected")
|
clearGroup(mapproxy, "selected")
|
||||||
clearGroup(mapproxy, "layer_heatmap")
|
clearGroup(mapproxy, "layer_heatmap")
|
||||||
|
# Entfernt eine eventuell existierende Legende vom vorherigen Durchlauf
|
||||||
|
removeControl(mapproxy, "heatmap_legend")
|
||||||
|
|
||||||
if (heatmap != "") {
|
if (heatmap != "") {
|
||||||
hideGroup(mapproxy, "layer_bezirke")
|
hideGroup(mapproxy, "layer_bezirke")
|
||||||
hideGroup(mapproxy, "layer_stadtteile")
|
hideGroup(mapproxy, "layer_stadtteile")
|
||||||
@@ -68,6 +71,14 @@ server <- function(input, output, session) {
|
|||||||
weight = 3,
|
weight = 3,
|
||||||
fillOpacity = 0.8
|
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 {
|
} else {
|
||||||
if (maptype == "Bezirke"){
|
if (maptype == "Bezirke"){
|
||||||
|
|||||||
Reference in New Issue
Block a user