Skip to content

Commit

Permalink
simple solution to #64
Browse files Browse the repository at this point in the history
  • Loading branch information
Aariq committed Apr 29, 2024
1 parent c148f7b commit e1b039f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/geotargets-option.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ geotargets_option_set <- function(
) {

options(
"geotargets.gdal.raster.driver" = gdal_raster_driver,
"geotargets.gdal.raster.creation.options" = gdal_raster_creation_options,
"geotargets.gdal.vector.driver" = gdal_raster_creation_options,
"geotargets.gdal.vector.creation.options" = gdal_raster_creation_options
"geotargets.gdal.raster.driver" = gdal_raster_driver %||% geotargets_option_get("gdal.raster.driver"),
"geotargets.gdal.raster.creation.options" = gdal_raster_creation_options %||% geotargets_option_get("gdal.raster.creation.options"),
"geotargets.gdal.vector.driver" = gdal_vector_driver %||% geotargets_option_get("gdal.vector.driver"),
"geotargets.gdal.vector.creation.options" = gdal_vector_creation_options %||% geotargets_option_get("gdal.vector.creation.options")
)

}
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-geotargets-option.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ test_that("geotargets_option_set() works", {
expect_equal(geotargets_option_get("gdal_raster_driver"), "COG")
})

test_that("options aren't reset with multiple calls to geotargets_option_set()", {
geotargets_option_set(gdal_raster_driver = "GPKG")
geotargets_option_set(gdal_vector_driver = "GPKG")
expect_equal(geotargets_option_get("gdal_vector_driver"), "GPKG")
expect_equal(geotargets_option_get("gdal_raster_driver"), "GPKG")
})

0 comments on commit e1b039f

Please sign in to comment.