Replies: 1 comment
-
There's currently no rdeck interface for switching basemaps, but you can use a shiny input and update the map in an observer. Something like this: library(shiny)
library(rdeck)
ui <- fillPage(
rdeckOutput("map", height = "100%"),
absolutePanel(
top = 10, right = 10,
selectInput(
"map_style",
NULL,
c(
"Mapbox Dark" = stylebox::mapbox_dark(),
"Mapbox Light" = stylebox::mapbox_light(),
"Mapbox Satellite Streets" = stylebox::mapbox_satellite_streets()
)
)
)
)
server <- function(input, output, session) {
output$map <- renderRdeck(rdeck())
observeEvent(input$map_style, {
rdeck_proxy("map", map_style = input$map_style)
})
}
shinyApp(ui, server) This same pattern can be applied to all rdeck options and layers. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any easier way to have multiple map_styles in a rdeck() shiny app?
Beta Was this translation helpful? Give feedback.
All reactions