ff_layer_wetdry.Rd
Function to toggle the wet/dry layer on an existing leaflet map.
ff_layer_wetdry(m, show = TRUE)
An initialized leaflet
map object or leafletProxy
object.
A boolean value indicating whether the function call will be adding the layer to the map (TRUE
) or removing the layer from the map (FALSE
). Designed to be changed via shiny
checkbox input by calling the function inside an observer.
# show the layer on a leaflet map object ("m")
m <- ff_make_leaflet()
m |> ff_layer_wetdry(show = TRUE)
# hide the layer on a leaflet map object ("m")
m |> ff_layer_wetdry(show = FALSE)
# use as part of a Shiny app with map "mainMap" and a boolean selector "show_wetdry"
if(FALSE){
shiny::observe({
proxy <- leaflet::leafletProxy("mainMap")
proxy |> ff_layer_wetdry(show = input$show_wetdry)
})
}