Commit 4f459005 authored by Virgile Baudrot's avatar Virgile Baudrot
Browse files

export KML and CSV of Interactive Map

parent c0de7a33
......@@ -268,7 +268,7 @@ mod_tabItemDamage_server <- function(input, output, session, r){
observe({
r$damageINDIVIDUAL <- damageINDIVIDUAL()
})
### Download EXPOSURE CSV
### Download DAMAGE CSV
output$download_DAMAGE <- downloadHandler(
filename = function() {
paste("download_DAMAGE_", Sys.Date(), ".csv", sep = "")
......@@ -280,7 +280,7 @@ mod_tabItemDamage_server <- function(input, output, session, r){
readr::write_csv(dfDAM, file)
}
)
### Download EXPOSURE KML
### Download DAMAGE KML
output$download_DAMAGEkml <- downloadHandler(
filename = function() {
paste("download_DAMAGE_", Sys.Date(), ".kml", sep = "")
......
......@@ -103,7 +103,14 @@ mod_tabItemInteractiveMap_ui <- function(id){
),
column(width = 10,
leafletOutput(ns("mapRISK"), height = 500)
)
),
p("You can download the data just generated through the CSV and the KML files."),
downloadButton(ns("download_InteractiveMap_CSV"),
"Download Interactive Map CSV",
style="color: #fff; background-color: #33595f; border-color: #052327"),
downloadButton(ns("download_InteractiveMap_KML"),
"Download Interactive Map KML",
style="color: #fff; background-color: #33595f; border-color: #052327")
)
),
briskaRshinyApp::footerPage()
......@@ -244,7 +251,32 @@ mod_tabItemInteractiveMap_server <- function(input, output, session, r){
)
})
### --- DAMAGE
### --- INTERACTIVE MAP
### Download INTERACTIVE MAP CSV
output$download_InteractiveMap_CSV <- downloadHandler(
filename = function() {
paste("download_DAMAGE_", Sys.Date(), ".csv", sep = "")
},
content = function(file) {
dfDAM = r$damageINDIVIDUAL %>%
dplyr::select(Date, EXPOSURE, DAMAGE) %>%
tidyr::unnest(c(Date, EXPOSURE, DAMAGE))
readr::write_csv(dfDAM, file)
}
)
### Download INTERACTIVE MAP KML
output$download_InteractiveMap_KML <- downloadHandler(
filename = function() {
paste("download_DAMAGE_", Sys.Date(), ".kml", sep = "")
},
content = function(file) {
dfDAMkml = r$damageINDIVIDUAL %>%
dplyr::select(Date, EXPOSURE, DAMAGE) %>%
tidyr::unnest(c(Date, EXPOSURE, DAMAGE))
sf::st_write(dfDAMkml, file)
}
)
#--- Color Map
DFdamageUNNEST <- reactive({
if(!is.null(r$damageINDIVIDUAL)){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment