We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As stated in the title, I need to be able to remove a GeoRaster and replace it with a different one in a shiny app. Is there a way to do this?
The text was updated successfully, but these errors were encountered:
The leaflet methods hideGroup/showGroup/clearGroup should work. Here is an example:
hideGroup/showGroup/clearGroup
library(shiny) library(leaflet) library(leafem) tif = system.file("tif/L7_ETMs.tif", package = "stars") x1 = read_stars(tif) x1_b3 = x1[, , , 3] # band 3 ui <- fluidPage( actionButton("hide", "Hide Group"), actionButton("show", "Show Group"), actionButton("clea", "Remove Group"), actionButton("add1", "Add new Group"), leafletOutput("map") ) server <- function(input, output, session) { output$map <- renderLeaflet({ leaflet() %>% addTiles() %>% leafem:::addGeoRaster( x1_b3 , opacity = 1 , group = "initial" , colorOptions = colorOptions( palette = grey.colors(256) ) ) }) observeEvent(input$hide, { leafletProxy("map") %>% hideGroup("initial") }) observeEvent(input$show, { leafletProxy("map") %>% showGroup("initial") }) observeEvent(input$clea, { leafletProxy("map") %>% leaflet::clearGroup("initial") }) observeEvent(input$add1, { x1_b2 = x1[1, , , 1] # band 2 leafletProxy("map") %>% leaflet::clearGroup("initial") %>% leafem:::addGeoRaster( x1_b2 , opacity = 1 , group = "added" , colorOptions = colorOptions( palette = grey.colors(256) ) ) }) } shinyApp(ui, server)
Sorry, something went wrong.
No branches or pull requests
As stated in the title, I need to be able to remove a GeoRaster and replace it with a different one in a shiny app. Is there a way to do this?
The text was updated successfully, but these errors were encountered: