SatishR
SatishR

Reputation: 230

display of mapview object in shiny

I’m trying to have two spatial plots side-by-side in shiny, and I was suggested a powerful function, sync of mapview. sync allows to have multiple maps for comparison, a great feature, but unable to figure out integrating or calling its output in shiny.
I have gone through ‘mapview for shiny’ and other related links mapview/shiny. The former suggested using renderMapview and mapviewOutput, however it did not work, i.e., no map being displayed. Please see the reproducible code. Also, I tried using @map slot of mapview object in renderLeaflet and calling it via leafletOutput - did not work. In both cases, a shiny window pops up and does not display anything. However, do see the following message in the command window: Warning in spCheckObject(x) : Columns CCN_1 in attribute table contain only NA values and are dropped. - it is related to the data base and confirms that mapview command is being executed but does not provide any leads on absence of plots.

library(shiny)
library(mapview)
ui <- fluidPage(
   mapviewOutput("samplemap"),
   p()
)
server <- function(input, output, session) {
   output$samplemap <- renderMapview({
      mapview(gadmCHE)
      })
}
shinyApp(ui, server)

Upvotes: 0

Views: 1322

Answers (0)

Related Questions