I'm trying to download a shapefile that comes from the writeOGR function. However it's not working and it can't download the shapefile. Does anyone know how to fix this? I really appreciate! Here comes the server.R:
output$shapefile <- renderUI({
if(is.null(input$action))
return(NULL)
else
isolate({
if(is.null(input$checkboxpd))
return(NULL)
else
downloadHandler(
filename = function() {
paste("Arvores_indiv_LiDAR", "shp", sep=".")
},
content = function() {
trees5 <- FindTreesCHM(fchm(), (as.numeric(input$fws)), (as.numeric(input$minht)))
lots <- SpatialPointsDataFrame(coords = cbind(trees5), data = trees5)
writeOGR(lots, dsn="Arvores_indiv_LiDAR.shp", layer = "Arvores_indiv_LiDAR", driver = "ESRI Shapefile")
dev.off
})
})
})
Thanks a lot! :)