getCreationOptions: Return the list of creation options for a GDAL driver

View source: R/gdal_helpers.R

getCreationOptionsR Documentation

Return the list of creation options for a GDAL driver

Description

getCreationOptions() returns the list of creation options supported by a GDAL format driver. This function is a wrapper of GDALGetDriverCreationOptionList() in the GDAL API, parsing its XML output into a named list.

Usage

getCreationOptions(format, filter = NULL)

Arguments

format

Format short name (e.g., "GTiff").

filter

Optional character vector of creation option names.

Details

The output is a nested list with names matching the creation option names. The information for each creation option is a named list with the following elements:

  • ⁠$type⁠: a character string describing the data type, e.g., "int", "float", "string". The type "string-select" denotes a list of allowed string values which are returned as a character vector in the ⁠$values⁠ element (see below).

  • ⁠$description⁠: a character string describing the option, or NA if no description is provided by the GDAL driver.

  • ⁠$default⁠: the default value of the option as either a character string or numeric value, or NA if no description is provided by the GDAL driver.

  • ⁠$values⁠: a character vector of allowed string values for the creation option if ⁠$type⁠ is "string-select", otherwise NULL if the option is not a "string-select" type.

  • ⁠$min⁠: (GDAL >= 3.11) the minimum value of the valid range for the option, or NA if not provided by the GDAL driver or the option is not a numeric type.

  • ⁠$max⁠: (GDAL >= 3.11) the maximum value of the valid range for the option, or NA if not provided by the GDAL driver or the option is not a numeric type.

Value

A named list with names matching the creation option names, and each element a named list with elements ⁠$type⁠, ⁠$description⁠, ⁠$default⁠ and ⁠$values⁠ (see Details).

See Also

create(), createCopy(), translate(), validateCreationOptions(), warp()

Examples

opt <- getCreationOptions("GTiff", "COMPRESS")
names(opt)

(opt$COMPRESS$type == "string-select")  # TRUE
opt$COMPRESS$values

all_opt <- getCreationOptions("GTiff")
names(all_opt)

# $description and $default will be NA if no value is provided by the driver
# $values will be NULL if the option is not a 'string-select' type

all_opt$PREDICTOR

all_opt$BIGTIFF

gdalraster documentation built on June 8, 2025, 12:37 p.m.