From e5e0fa7c68b04c6086a33fc222919ab8df56da31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Salamon?= Date: Thu, 17 Oct 2024 11:14:08 +0200 Subject: [PATCH] finished showing of proper raster when user clicks on Disease outbreak tab --- .../disease_outbreaks/disease_leaflet_map.R | 18 +++++++++--------- .../disease_app/disease_app.R | 4 ++-- .../disease_app/disease_map.R | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/logic/disease_outbreaks/disease_leaflet_map.R b/app/logic/disease_outbreaks/disease_leaflet_map.R index 987785b..f007f27 100644 --- a/app/logic/disease_outbreaks/disease_leaflet_map.R +++ b/app/logic/disease_outbreaks/disease_leaflet_map.R @@ -1,6 +1,6 @@ box::use( terra[rast, project], - leaflet[leaflet, addTiles, addRasterImage, setView, leafletProxy, removeImage] + leaflet[leaflet, addTiles, addRasterImage, setView, leafletProxy, removeImage, addRasterLegend, addLegend] ) #' @export @@ -25,14 +25,14 @@ disease_leaflet_map <- function(map_raster, opacity = 0.9, project = FALSE, group = "Disease layer" - ) |> - addRasterLegend( - map_raster, - opacity = 0.9, - position = "bottomright", - group = "Diseaselayer", - className = "info legend Diseaselayer" - ) + ) # |> + # addLegend( + # map_raster, + # opacity = 0.9, + # position = "bottomright", + # group = "Diseaselayer", + # className = "info legend Diseaselayer" + # ) return(leaflet_map) } \ No newline at end of file diff --git a/app/view/disease_outbreaks/disease_app/disease_app.R b/app/view/disease_outbreaks/disease_app/disease_app.R index 1229925..02aac69 100644 --- a/app/view/disease_outbreaks/disease_app/disease_app.R +++ b/app/view/disease_outbreaks/disease_app/disease_app.R @@ -49,14 +49,14 @@ disease_app_server <- function(id, tab_disease_selected) { map() |> disease_leaflet_map( add_control = TRUE, - main_map_features = TRUE, + main_map_features = TRUE ) |> leaflet_map() # MAP itself ---- disease_map_server( "disease_map", - leaflet_map = leaflet_map, + leaflet_map = leaflet_map ) } ) diff --git a/app/view/disease_outbreaks/disease_app/disease_map.R b/app/view/disease_outbreaks/disease_app/disease_map.R index 6f1bd5a..2689346 100644 --- a/app/view/disease_outbreaks/disease_app/disease_map.R +++ b/app/view/disease_outbreaks/disease_app/disease_map.R @@ -1,5 +1,5 @@ box::use( - shiny[NS, moduleServer, tags, observeEvent, reactive, actionButton, reactiveVal, checkboxInput, updateCheckboxInput], + shiny[NS, moduleServer, tags, observeEvent, reactive, actionButton, reactiveVal, checkboxInput, updateCheckboxInput, req], bslib[card, card_header, card_body], leaflet[setView, leaflet, leafletOptions, leafletOutput, renderLeaflet, addTiles, leafletProxy, addRasterImage, clearImages], terra[rast, project],