I’m trying to have two spatial plots side-by-side in shiny, and I was suggested a powerful function, sync
of mapview
. After figuring how to display mapview
object in shiny
, I tried to integrate sync
in 'shiny', but got the following error: Error in slot(x, "map") : no slot of name "map" for this object of class "shiny.tag.list" . Does it mean sync
does not have map object, therefore, it is not possible to integrate sync
or latticeView
with shiny
? If so, I guess there should be workaround solutions and my ears are all open. This is a nice feature to have access from Shiny and allows to do some interesting things. Greatly appreciate any suggestions. Here is the sample reproducible code:
library(shiny)
library(mapview)
ui <- fluidPage(
mapviewOutput("samplemap"),
p()
)
server <- function(input, output, session) {
output$samplemap <- renderMapview({
m1 <- mapview(gadmCHE,zcol="ID_1")
m2 <- mapview(gadmCHE,zcol="OBJECTID")
sync(m1,m2)
})
}
shinyApp(ui, server)
This is useful, however, the map was being displayed only when `sync` object inserted as `ui`. I am unable to add maps dynamically, i.e., the code with `renderUI` and `uiOutput` opened a window but with no map. Not sure why? Also, I would like to know whether I can create a `sync` object in an reactive expression using `renderLeaflet` objects and later use in `renderUI` and `'uiOutput` ? Greatly appreciate your suggestions. – SatishR Oct 28 '16 at 14:26