Show/hide the latitude and longitude grid on the map
Arguments
- proxy
The map proxy object created by
mapProxy().- show
Logical indicating whether to show or hide the grid. Default is
TRUE.
Examples
if(interactive()){
library(shiny)
library(toro)
ui <- fluidPage(
tagList(
mapOutput("map"),
actionButton("show_grid", "Show Grid"),
actionButton("hide_grid", "Hide Grid")
)
)
server <- function(input, output, session) {
output$map <- renderMap({
map() |>
add_lat_lng_grid()
})
observe({
mapProxy("map") |>
toggle_lat_lng_grid(show = TRUE)
}) |>
bindEvent(input$show_grid)
observe({
mapProxy("map") |>
toggle_lat_lng_grid(show = FALSE)
}) |>
bindEvent(input$hide_grid)
}
}
