Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare() in Shiny #20

Open
isaacbain opened this issue Jul 18, 2024 · 2 comments
Open

Compare() in Shiny #20

isaacbain opened this issue Jul 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@isaacbain
Copy link

Hello,

I can't seem to get compare() working in a Shiny app. I've tried to make a minimal reproducible example here. It gives the error: Warning in renderWidget(instance) : Ignoring explicitly provided widget ID "compare-container-db634"; Shiny doesn't use them.

# Load libraries
library(shiny)
library(mapgl)

# Define UI
ui <- fluidPage(
  titlePanel("Map Comparison"),
  mainPanel(
    mapboxglOutput("compare_map", height = "800px")
  )
)

# Define Server logic
server <- function(input, output, session) {
  
  output$compare_map <- renderMapboxgl({
    m1 <- mapboxgl(style = mapbox_style("light"))
    m2 <- mapboxgl(style = mapbox_style("dark"))
    
    # Use the compare function as documented
    compare(m1, m2)
  })
}

# Run the application
shinyApp(ui = ui, server = server)
@walkerke
Copy link
Owner

compare() doesn't work in Shiny yet. Because of how it's structured it's technically a separate HTMLwidget that would need its own render function. I'd like to get this working eventually!

@research-flow
Copy link

Hey, I would love to get this working, however I am not really familiarised with rendering HTMLwidgets yet. Are there any updates on this function? Thanks!

@walkerke walkerke added the enhancement New feature or request label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants