mapdeck
mapdeck copied to clipboard
Click-event circular references
https://github.com/SymbolixAU/mapdeck/issues/364 is now happening with click-events
library(shinydashboard)
library(mapdeck)
library(sf)
set_token(secret::get_secret("MAPBOX"))
ui <- shinydashboard::dashboardPage(
header = shinydashboard::dashboardHeader()
, body = shinydashboard::dashboardBody(
mapdeck::mapdeckOutput(
outputId = "map"
)
)
, sidebar = shinydashboard::dashboardSidebar()
)
server <- function(input, output, session) {
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
output$map <- mapdeck::renderMapdeck({
mapdeck::mapdeck() %>%
add_polygon(
data = nc
)
})
observeEvent({input$map_polygon_click}, {
print(input$map_polygon_click)
})
}
shiny::shinyApp(ui = ui, server = server)