Render a gdal_opts() object to the form consumed by the GDAL algorithm API
(gdalraster::gdal_alg() / gdalraster::gdal_run()).
Usage
as_gdal_args(x, ...)
# S3 method for class 'gdal_opts'
as_gdal_args(x, cli = TRUE, long = FALSE, with_format = FALSE, ...)
# S3 method for class 'character'
as_gdal_args(x, ...)
# S3 method for class 'list'
as_gdal_args(x, ...)
# Default S3 method
as_gdal_args(x, ...)Arguments
- x
A
gdal_opts()object (or a character vector / list, passed through).- ...
Passed to methods.
- cli
Logical; emit interleaved CLI tokens (
TRUE, default) or a bareKEY=VALUEvector.- long
Logical; use long flag names (
--open-option) rather than aliases (--oo).- with_format
Logical; prepend the
--input-format/--output-formatflag and driver when known (open/creation only).
Details
For repeated options (--oo/--co/--lco), GDAL requires each value to be preceded by its own
flag - values are never comma-packed (a packed value would corrupt options such as
PRELUDE_STATEMENTS that themselves contain ;/,). Accordingly:
cli = TRUE(default) emits a flat token vectorc("--open-option", "K=V", "--open-option", "K2=V2", ...), suitable as theargstogdalraster::gdal_alg().cli = FALSEemits an unnamedc("K=V", ...)vector, suitable for a singlealg$setArg(<flag>, .)call.
Examples
as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE, driver = "GPKG"))
#> [1] "--oo" "LIST_ALL_TABLES=NO"
as_gdal_args(gdal_open_opts(LIST_ALL_TABLES = FALSE), cli = FALSE)
#> [1] "LIST_ALL_TABLES=NO"