Skip to content

Commit

Permalink
fix export shapefile
Browse files Browse the repository at this point in the history
  • Loading branch information
dindiarto committed Aug 6, 2024
1 parent 91a4952 commit 1cce5d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/sm_suitability_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ suitabilityAnalysisServer <- function(id, submittedData) {
content = function(file) {
# Save the suitability map to a temporary directory
tempdir <- tempdir()
browser()
suitability_map <- suitabilityResults()$suitability_polygon
st_write(suitability_map, file.path(tempdir, "suitability_map.shp"),
suitability_map <- suitabilityResults()$suitability_polygon %>%
dplyr::select(ID, suitability, count)
sf::st_write(suitability_map, paste0(tempdir, "\\suitability_map.shp"),
append = FALSE)

shp_files <- list.files(path = tempdir, pattern = "suitability_map", full.names = TRUE)
# Zip the temporary directory and write it to the specified file
zip(file, tempdir)
zip(file,files=shp_files, extras = "-x")
}
)

Expand Down

0 comments on commit 1cce5d1

Please sign in to comment.