diff --git a/R/geotargets-option.R b/R/geotargets-option.R index 5d0e040..79c6ce1 100644 --- a/R/geotargets-option.R +++ b/R/geotargets-option.R @@ -6,7 +6,7 @@ #' @param gdal_raster_driver character, length 1; set the driver used for raster #' data in target store (default: `"GTiff"`). Options for driver names can be #' found here: -#' @param gdla_raster_creation_options character, length 1; set the GDAL creation options +#' @param gdal_raster_creation_options character; set the GDAL creation options #' used when writing raster files to target store (default: `""`). You may #' specify multiple values e.g. `c("COMPRESS=DEFLATE", "TFW=YES")`. Each GDAL #' driver supports a unique set of creation options. For example, with the @@ -14,7 +14,7 @@ #' #' @param gdal_vector_driver character, length 1; set the file type used for #' vector data in target store (default: `"GeoJSON"`). -#' @param gdal_vector_creation_options character, length 1; set the GDAL layer creation +#' @param gdal_vector_creation_options character; set the GDAL layer creation #' options used when writing vector files to target store (default: #' `"ENCODING=UTF-8"`). You may specify multiple values e.g. #' `c("WRITE_BBOX=YES", "COORDINATE_PRECISION=10")`. Each GDAL driver supports diff --git a/man/geotargets-options.Rd b/man/geotargets-options.Rd index c36db34..c7a6099 100644 --- a/man/geotargets-options.Rd +++ b/man/geotargets-options.Rd @@ -19,10 +19,7 @@ geotargets_option_get(name) data in target store (default: \code{"GTiff"}). Options for driver names can be found here: \url{https://gdal.org/drivers/raster/index.html}} -\item{gdal_vector_driver}{character, length 1; set the file type used for -vector data in target store (default: \code{"GeoJSON"}).} - -\item{gdal_vector_creation_options}{character, length 1; set the GDAL layer creation +\item{gdal_raster_creation_options}{character; set the GDAL layer creation options used when writing vector files to target store (default: \code{"ENCODING=UTF-8"}). You may specify multiple values e.g. \code{c("WRITE_BBOX=YES", "COORDINATE_PRECISION=10")}. Each GDAL driver supports @@ -30,14 +27,10 @@ a unique set of creation options. For example, with the default \code{"GeoJSON"} driver: \url{https://gdal.org/drivers/vector/geojson.html#layer-creation-options}} -\item{name}{character; option name to get} +\item{gdal_vector_driver}{character, length 1; set the file type used for +vector data in target store (default: \code{"GeoJSON"}).} -\item{gdla_raster_creation_options}{character, length 1; set the GDAL creation options -used when writing raster files to target store (default: \code{""}). You may -specify multiple values e.g. \code{c("COMPRESS=DEFLATE", "TFW=YES")}. Each GDAL -driver supports a unique set of creation options. For example, with the -default \code{"GTiff"} driver: -\url{https://gdal.org/drivers/raster/gtiff.html#creation-options}} +\item{name}{character; option name to get} } \description{ Get or set behavior for geospatial data target stores using diff --git a/tests/testthat/test-tar-terra.R b/tests/testthat/test-tar-terra.R index 15f0175..a4c550f 100644 --- a/tests/testthat/test-tar-terra.R +++ b/tests/testthat/test-tar-terra.R @@ -1,50 +1,50 @@ # test_that() #Included to make RStudio recognize this file as a test targets::tar_test("tar_terra_rast() works", { - geotargets::geotargets_option_set("raster_gdal_creation_options", c("COMPRESS=DEFLATE", "TFW=YES")) - targets::tar_script({ - list( - geotargets::tar_terra_rast( - test_terra_rast, - terra::rast(system.file("ex/elev.tif", package = "terra")) - ) + # geotargets::geotargets_option_set(gdal_raster_creation_options = c("COMPRESS=DEFLATE", "TFW=YES")) + targets::tar_script({ + list( + geotargets::tar_terra_rast( + test_terra_rast, + terra::rast(system.file("ex/elev.tif", package = "terra")) + ) + ) + }) + targets::tar_make() + x <- targets::tar_read(test_terra_rast) + expect_s4_class(x, "SpatRaster") + expect_snapshot( + x ) - }) - targets::tar_make() - x <- targets::tar_read(test_terra_rast) - expect_s4_class(x, "SpatRaster") - expect_snapshot( - x - ) }) targets::tar_test("tar_terra_vect() works", { - targets::tar_script({ - lux_area <- function(projection = "EPSG:4326") { - terra::project( - terra::vect(system.file("ex", "lux.shp", - package = "terra" - )), - projection - ) - } - list( - geotargets::tar_terra_vect( - test_terra_vect, - lux_area() - ), - geotargets::tar_terra_vect( - test_terra_vect_shz, - lux_area(), - filetype = "ESRI Shapefile" - ) - ) - }) - targets::tar_make() - x <- targets::tar_read(test_terra_vect) - y <- targets::tar_read(test_terra_vect_shz) - expect_s4_class(x, "SpatVector") - expect_s4_class(y, "SpatVector") - expect_snapshot(x) - expect_snapshot(y) - expect_equal(terra::values(x), terra::values(y)) + targets::tar_script({ + lux_area <- function(projection = "EPSG:4326") { + terra::project( + terra::vect(system.file("ex", "lux.shp", + package = "terra" + )), + projection + ) + } + list( + geotargets::tar_terra_vect( + test_terra_vect, + lux_area() + ), + geotargets::tar_terra_vect( + test_terra_vect_shz, + lux_area(), + filetype = "ESRI Shapefile" + ) + ) + }) + targets::tar_make() + x <- targets::tar_read(test_terra_vect) + y <- targets::tar_read(test_terra_vect_shz) + expect_s4_class(x, "SpatVector") + expect_s4_class(y, "SpatVector") + expect_snapshot(x) + expect_snapshot(y) + expect_equal(terra::values(x), terra::values(y)) })