if(interactive()){
library(shiny)
library(toro)
ui <- fluidPage(
tagList(
mapOutput("map")
)
)
server <- function(input, output, session) {
output$map <- renderMap({
map() |>
add_draw_control()
})
# Update the list of drawn shape IDs when a new shape is created
observe({
req(input$map_loaded, input$map_shape_created)
new_shape <- get_drawn_shape(input$map_shape_created)
print(new_shape)
}) |>
bindEvent(input$map_shape_created)
}
}
Run the code above in your browser using DataLab