I am building a Shiny app with a Leaflet map based on a PostgreSQL spatialdatabase.
I succeeded to import spatial data into SpatialPolygonDataFrame and to display it on Leaflet widget.
I am trying to display the data from the SpatialDataFrame with a RenderTable output, but its not working, even by converting it with as.data.frame(spatialdataframe). Therefore this conversion is enough to dispay the table with view(), kable() or other display functions, but not in Shiny.
Should I make another conversion? Anyone got an idea?
ui <- fluidPage(
titlePanel("AgriPAG"),
sidebarLayout(
mainPanel(
tabsetPanel(
tabPanel(leafletOutput("m",width = "100%", height = 1000)),
tabPanel(tableOutput(as.data.frame(sample_test1)))
)
),
sidebarPanel("curseur")
)
)
server <- function(input,output, session){
data <- reactive({
x <- test1
})
output$mymap <- renderLeaflet({
test1 <- data()
m <- leaflet(data = sample_test1) %>%
addTiles() %>%
setView(lng=-52.3333300, lat=4.9333300 , zoom=10) %>%
addPolygons(data=sample_test1, weight=2, col="black", opacity=0.5)
m
})
output$table <- renderDataTable(as.data.frame(sample_test1))
}
shinyApp(ui = ui, server = server)
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)