Skip to content

Commit

Permalink
revert back to useing strsplit and paste0
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed May 3, 2024
1 parent 0530463 commit 7be1613
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
13 changes: 10 additions & 3 deletions R/tar-terra-rast.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ tar_terra_rast <- function(name,
path,
filetype = Sys.getenv("GEOTARGETS_GDAL_RASTER_DRIVER"),
overwrite = TRUE,
gdal = geotargets:::semicolon_split(Sys.getenv("GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS", unset = ";"))
gdal = strsplit(
Sys.getenv("GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS",
unset = ";"),
";")[[1]]
)
},
marshal = function(object) terra::wrap(object),
Expand All @@ -103,8 +106,12 @@ tar_terra_rast <- function(name,
resources = targets::tar_resources(
custom_format = targets::tar_resources_custom_format(
#these envvars are used in write function of format
envvars = c("GEOTARGETS_GDAL_RASTER_DRIVER" = filetype,
"GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS" = geotargets:::semicolon_paste(gdal))
envvars = c(
"GEOTARGETS_GDAL_RASTER_DRIVER" = filetype,
"GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS" = (
paste0(gdal, collapse = ";")
)
)
)
),
storage = storage,
Expand Down
8 changes: 6 additions & 2 deletions R/tar-terra-sprc.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ tar_terra_sprc <- function(name,
resources = targets::tar_resources(
custom_format = targets::tar_resources_custom_format(
#these envvars are used in write function of format
envvars = c("GEOTARGETS_GDAL_RASTER_DRIVER" = filetype,
"GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS" = geotargets:::semicolon_paste(gdal))
envvars = c(
"GEOTARGETS_GDAL_RASTER_DRIVER" = filetype,
"GEOTARGETS_GDAL_RASTER_CREATION_OPTIONS" = (
paste0(gdal, collapse = ";")
)
)
)
),
storage = storage,
Expand Down
18 changes: 14 additions & 4 deletions R/tar-terra-vect.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ tar_terra_vect <- function(name,
resources = targets::tar_resources(
custom_format = targets::tar_resources_custom_format(
#these envvars are used in write function of format
envvars = c("GEOTARGETS_GDAL_VECTOR_DRIVER" = filetype,
"GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS" = geotargets:::semicolon_paste(gdal))
envvars = c(
"GEOTARGETS_GDAL_VECTOR_DRIVER" = filetype,
"GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS" = (
paste0(gdal, collapse = ";")
)
)
)
),
storage = storage,
Expand All @@ -129,7 +133,10 @@ create_format_terra_vect <- function() {
path,
filetype = Sys.getenv("GEOTARGETS_GDAL_VECTOR_DRIVER"),
overwrite = TRUE,
options = geotargets:::semicolon_split(Sys.getenv("GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS", unset = ";"))
options = strsplit(
Sys.getenv("GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS",
unset = ";"),
";")[[1]]
)
},
marshal = function(object) terra::wrap(object),
Expand All @@ -151,7 +158,10 @@ create_format_terra_vect_shz <- function() {
filename = paste0(path, ".shz"),
filetype = "ESRI Shapefile",
overwrite = TRUE,
options = geotargets:::semicolon_split(Sys.getenv("GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS", unset = ";"))
options = strsplit(
Sys.getenv("GEOTARGETS_GDAL_VECTOR_CREATION_OPTIONS",
unset = ";"),
";")[[1]]
)
file.rename(paste0(path, ".shz"), path)
},
Expand Down

0 comments on commit 7be1613

Please sign in to comment.