display of mapview object in shiny

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 07:19:11

问题


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. Greatly appreciate suggestions or clues on displaying mapview geneated plots in shiny.

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

来源:https://stackoverflow.com/questions/40270966/display-of-mapview-object-in-shiny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!