Configuration options

gdalcubes heavily relies on GDAL to read image data. GDAL itself comes with a lot of configuration options that can be set to improve computation times and I/O or network transfer performance. Below, you find the most important options for gdalcubes with a brief description. Please refer to the original documentation for details.

Configuration option Description
GDAL_CACHEMAX Size of the default block cache, can be set in byte, MB, or as a percentage of available main, memory. Defaults to 256 MB
GDAL_DISABLE_READDIR_ON_OPEN Set to TRUE or EMPTY_DIR to avoid listing all files in the directory once a single file is opened (this is highly recommended). Defaults to TRUE
GDAL_NUM_THREADS Number of threads GDAL can use for block reads and (de)compression, set to ALL_CPUS to use all available cores. Defaults to 1.
VSI_CACHE Enable / disable per-file caching by setting to TRUE or FALSE. Default is FALSE.
VSI_CACHE_SIZE Per-file cache size in bytes, defaults to 25 MB.
CPL_VSIL_CURL_CACHE_SIZE Global cache size for downloads in bytes, defaults to 16 MB.

Please consider that settings apply for each gdalcubes worker process and you should calculate memory limits such as cache sizes accordingly. To set a configuration option, you can use gdalcubes_set_gdal_config() as in the following examples.

gdalcubes_set_gdal_config("GDAL_NUM_THREADS", "ALL_CPUS")
gdalcubes_set_gdal_config("VSI_CACHE", "TRUE")
gdalcubes_set_gdal_config("VSI_CACHE_SIZE", as.character(5*1000*1000)) # 5 MB per file
gdalcubes_set_gdal_config("GDAL_CACHEMAX", "2%")