gdalUtils
gdalUtils copied to clipboard
Fix --config parameter
in gdalUtils::gdal_translate()
one can set config parameters using the double-dashed option config
which will be forwarded to gdal_translate
.
The correct usage of this in gdal would be as a key value pair:
gdal_translate --config GDAL_CACHEMAX "42%"
However, gdalUtils calls it as follows, resulting in an error (I am aware that this would result in an error anyways as no file is supplied, yet it would be different).
gdal_config <- c('GDAL_CACHEMAX "42%"')
guf_aoi <- gdalUtils::gdal_translate(config = gdal_config)
# ERROR 1: --config option given without a key and value argument.
# Warning message:
# In system(cmd, intern = TRUE) :
running command '"/usr/bin/gdal_translate" -of "GTiff" --config "GDAL_CACHEMAX "42%""' had status 1
I think the best way to fix this is to use named chr vectors like this:
gdal_config <- c(GDAL_CACHEMAX="30%")