Helper function to identify the folder of the GDAL installation, and its version
find_gdal()
character
full path to the gdal installation folder. The returned
object contains a version
attribute that can be used to retrieve the
GDAL version. The function first checks if the path was already retrieved
and set in the "sprawl_gdalpath" global variable. If not, it tries to locate
the path using (in sequence):
1. Sys.which()
2. gdalUtils::gdal_setInstallation(ignore_fullscan = TRUE)
3. gdalUtils::gdal_setInstallation(ignore_fullscan = FALSE)
If all fails, the function aborts. If a valid installation is found, then the global variable "sprawl_gdalpath" is set (this allows not to have to continuously look for the gdal folder on later executions)
gdalpath <- find_gdal() gdalpath#> [1] "/usr/bin" #> attr(,"version") #> [1] "2.3.2"