Skip to contents

Create GDAL configuration options.

Create GDAL creation options

Create GDAL warp options

Set the GDAL configuration options

Usage

gdal_config_opts(
  VSI_CACHE = "TRUE",
  GDAL_CACHEMAX = "50%",
  VSI_CACHE_SIZE = "268435456",
  GDAL_NUM_THREADS = "ALL_CPUS",
  GDAL_DISABLE_READDIR_ON_OPEN = "EMPTY_DIR",
  GDAL_MAX_DATASET_POOL_SIZE = "500",
  GDAL_INGESTED_BYTES_AT_OPEN = "32000",
  CPL_VSIL_CURL_ALLOWED_EXTENSIONS = ".tif .TIF",
  CPL_VSIL_CURL_USE_HEAD = "NO",
  GDAL_HTTP_MAX_RETRY = "5",
  GDAL_HTTP_RETRY_DELAY = "3",
  GDAL_HTTP_MULTIPLEX = "YES",
  GDAL_HTTP_VERSION = "2",
  GDAL_HTTP_MERGE_CONSECUTIVE_RANGES = "YES",
  ...
)

gdal_creation_options(
  output_format = NULL,
  COMPRESS = "LZW",
  PREDICTOR = "2",
  NUM_THREADS = "ALL_CPUS",
  BIGTIFF = "YES",
  TILED = "YES",
  BLOCKXSIZE = "128",
  BLOCKYSIZE = "128",
  COPY_SRC_OVERVIEWS = "YES",
  ...
)

gdalwarp_options(multi = TRUE, warp_memory = "50%", num_threads = "ALL_CPUS")

set_gdal_config(x, scope = c("gdalraster", "sys"))

Arguments

VSI_CACHE

cache related

GDAL_CACHEMAX

cache related

VSI_CACHE_SIZE

cache related

GDAL_NUM_THREADS

General options

GDAL_DISABLE_READDIR_ON_OPEN

General options

GDAL_MAX_DATASET_POOL_SIZE

General options

GDAL_INGESTED_BYTES_AT_OPEN

General options

CPL_VSIL_CURL_ALLOWED_EXTENSIONS

Optimize HTTP connections

CPL_VSIL_CURL_USE_HEAD

Optimize HTTP connections

GDAL_HTTP_MAX_RETRY

Optimize HTTP connections

GDAL_HTTP_RETRY_DELAY

Optimize HTTP connections

GDAL_HTTP_MULTIPLEX

Optimize HTTP connections

GDAL_HTTP_VERSION

General options

GDAL_HTTP_MERGE_CONSECUTIVE_RANGES

General options

...

Additional -co options to set

output_format

Output format equivalent to -of on the CLI. see details

COMPRESS

Compression method

PREDICTOR

Prediction method

NUM_THREADS

Number of threads

BIGTIFF

Use BigTIFF

TILED

Use tiling

BLOCKXSIZE

Block size in X

BLOCKYSIZE

Block size in Y

COPY_SRC_OVERVIEWS

Copy source overviews

multi

Logical indicating whether to use multi-threading, equivalent to -multi on the CLI

warp_memory

Memory to use for warping equivalent to -wm on the CLI

num_threads

Number of threads to use for warping equivalent to -wo NUM_THREADS on the CLI. "ALL_CPUS" (the default) will use all available CPUs, alternartively an integer can be supplied - or NULL to use a single threaded process.

x

A named character vector of the configuration options

scope

A character vector of the scope to set the options in. Either "gdalraster" or "sys".

Value

Character vector of options

Details

output_format, equaivalent to -of from the gdaltranslate or gdalwarp CLIs. If NULL, then the output format will be inferred from the file extension.

Examples

gdal_config_opts(GDAL_HTTP_USERPWD = "user:password")
#>                          VSI_CACHE                      GDAL_CACHEMAX 
#>                             "TRUE"                              "50%" 
#>                     VSI_CACHE_SIZE                   GDAL_NUM_THREADS 
#>                        "268435456"                         "ALL_CPUS" 
#>       GDAL_DISABLE_READDIR_ON_OPEN         GDAL_MAX_DATASET_POOL_SIZE 
#>                        "EMPTY_DIR"                              "500" 
#>        GDAL_INGESTED_BYTES_AT_OPEN   CPL_VSIL_CURL_ALLOWED_EXTENSIONS 
#>                            "32000"                        ".tif .TIF" 
#>             CPL_VSIL_CURL_USE_HEAD                GDAL_HTTP_MAX_RETRY 
#>                               "NO"                                "5" 
#>              GDAL_HTTP_RETRY_DELAY                GDAL_HTTP_MULTIPLEX 
#>                                "3"                              "YES" 
#>                  GDAL_HTTP_VERSION GDAL_HTTP_MERGE_CONSECUTIVE_RANGES 
#>                                "2"                              "YES" 
#>                  GDAL_HTTP_USERPWD 
#>                    "user:password" 
gdal_creation_options(COMPRESS = "JPEG", JPEG_QUALITY = "90")
#>  [1] "-co"                    "COMPRESS=JPEG"          "-co"                   
#>  [4] "PREDICTOR=2"            "-co"                    "NUM_THREADS=ALL_CPUS"  
#>  [7] "-co"                    "BIGTIFF=YES"            "-co"                   
#> [10] "TILED=YES"              "-co"                    "BLOCKXSIZE=128"        
#> [13] "-co"                    "BLOCKYSIZE=128"         "-co"                   
#> [16] "COPY_SRC_OVERVIEWS=YES" "-co"                    "JPEG_QUALITY=90"       
gdalwarp_options(multi = TRUE, warp_memory = "50%", num_threads = 4)
#> [1] "-multi"        "-wm"           "50%"           "-wo"          
#> [5] "NUM_THREADS=4"
set_gdal_config(gdal_config_opts())