I have a leaflet map with a selection of base groups and overlay groups, when i use the code
input$mymap_group[1]
this only shows me the first of the overlay groups selected not the base group. Is there a way to show the current selected base group?
library(shiny)
library(leaflet)
evar <- c("SST", "SLA", "CHL", "Eddies NS", "Eddies EW", "NPP")
groups <- c("12323", "1232455","3443", "23","987", "566")
ui <- fluidPage(
mainPanel(tags$style(type = "text/css", "#mymap {height: calc(100vh - 80px) !important;}"),
uiOutput("group_selected"),
leafletOutput("mymap"))
)
server <- function(input, output, session) {
output$group_selected <- renderUI({ h2(input$mymap_groups[1]) })
output$mymap <- renderLeaflet({
leaflet() %>% addTiles() %>% setView(lng = -20, lat = 14, zoom = 6) %>% addLayersControl(baseGroups = evar, overlayGroups = groups)
})
}
runApp(shinyApp(ui, server))