Commit e3166f3b authored by Virgile Baudrot's avatar Virgile Baudrot
Browse files

update interactiveMap: damage point size

parent 5c7d66f3
......@@ -80,11 +80,16 @@ mod_tabItemInteractiveMap_ui <- function(id){
plotOutput(ns("profileRISKdamage"))
),
column(width = 2,
checkboxInput(ns("damage"), "Show damage point", FALSE),
checkboxInput(ns("legend"), "Show legend", FALSE)
checkboxInput(ns("damage"), "Damage point", FALSE),
checkboxInput(ns("legend"), "Legend damage point", FALSE),
sliderInput(ns("radiusDamage"), "Radius damage point:",
min = 0, max = 1000,
value = 50),
),
column(width = 10,
leafletOutput(ns("mapDAMAGE"))
leafletOutput(ns("mapDAMAGE"), height = 500)
)
)
),
......@@ -222,13 +227,14 @@ mod_tabItemInteractiveMap_server <- function(input, output, session, r){
})
### --- DAMAGE
DFdamageRISK <- reactive({
if(!is.null(r$damageINDIVIDUAL)){
r$damageINDIVIDUAL %>%
tidyr::unnest( c(Date, DAMAGE)) %>%
dplyr::filter(Date == input$ctrlDATEMapDAMAGE)
}
})
# DFdamageRISK <- reactive({
# if(!is.null(r$damageINDIVIDUAL)){
# r$damageINDIVIDUAL %>%
# tidyr::unnest( c(Date, DAMAGE)) %>%
# dplyr::filter(Date == input$ctrlDATEMapRISK)
# }
# })
DFdamageUNNEST <- reactive({
if(!is.null(r$damageINDIVIDUAL)){
r$damageINDIVIDUAL %>%
......@@ -247,6 +253,8 @@ mod_tabItemInteractiveMap_server <- function(input, output, session, r){
req(r$landscapeSQUAREFRAME, r$landscapeSOURCE, r$landscapeHOST, r$individualSITE)
pal <- colorpalDAMAGE()
leaflet() %>%
addTiles() %>%
# fitBounds(frameBox[1]*(1-zoom),frameBox[2]*(1-zoom),frameBox[3]*(1+zoom), frameBox[4]*(1+zoom)) %>% # ~min(Long), ~min(Lat), ~max(Long), ~max(Lat)
......@@ -279,27 +287,25 @@ mod_tabItemInteractiveMap_server <- function(input, output, session, r){
observe({
# req(DFdamageRISK())
req(input$ctrlDATEMapDAMAGE)
req(input$ctrlDATEMapRISK)
req(r$damageINDIVIDUAL)
DFdamageRISK = r$damageINDIVIDUAL %>%
tidyr::unnest( c(Date, DAMAGE)) %>%
dplyr::filter(Date == input$ctrlDATEMapDAMAGE)
dplyr::filter(Date == input$ctrlDATEMapRISK)
proxyMap <- leafletProxy("mapDAMAGE")
proxyMap <- leafletProxy("mapDAMAGE") %>%
removeShape(layerId = "idLayerDamage")
proxyMap %>%
clearShapes(layerId = "idLayerDamage")
if(input$damage){
pal <- colorpalDAMAGE()
# leafletProxy("mapDAMAGE") %>%
proxyMap %>%
# clearShapes(layerId = "idLayerDamage") %>%
# clearShapes(layerId = "idLayerDamage") %>%
# removeShape(layerId = "idLayerDamage") %>%
addCircles(data = DFdamageRISK,
radius = 50, #~sqrt(DAMAGE),
# weight = 1, color = "#777777",
radius = input$radiusDamage, #~sqrt(DAMAGE),
# weight = 1,
color = ~pal(DAMAGE),
fillColor = ~pal(DAMAGE),
fillOpacity = 0.7,
layerId = "idLayerDamage")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment