From f9db9c9ba7633c51afbf0ceece0f42a5a42b385e Mon Sep 17 00:00:00 2001 From: Eric Scott Date: Wed, 11 Sep 2024 15:44:07 -0700 Subject: [PATCH] pass gdal opts down to writeRaster (fix for #93) --- R/tar-terra-sprc.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/tar-terra-sprc.R b/R/tar-terra-sprc.R index 5d68e15..dc03472 100644 --- a/R/tar-terra-sprc.R +++ b/R/tar-terra-sprc.R @@ -307,6 +307,11 @@ format_terra_collections <- function(type = c("sprc", "sds")) { "sds" = function(path) terra::sds(path) ), write = function(object, path) { + gdal <- strsplit( + Sys.getenv("GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS", + unset = ";"), + ";")[[1]] + for (i in seq(object)) { if (i > 1) { opt <- "APPEND_SUBDATASET=YES" @@ -318,7 +323,7 @@ format_terra_collections <- function(type = c("sprc", "sds")) { filename = path, filetype = Sys.getenv("GEOTARGETS_GDAL_RASTER_DRIVER"), overwrite = (i == 1), - gdal = opt + gdal = c(opt, gdal) ) } },