1

Is it possible to ask R {sf} package to use a GDAL installation I prefer?

So far I found how to check external software it uses:

library(sf)
sf_extSoftVersion()

#          GEOS           GDAL         proj.4 GDAL_with_GEOS 
#       "3.6.1"        "2.2.3"        "4.9.3"         "true" 

I am hoping I can choose a path to my existing GDAL installation like {gdalUtils} package does:

library(gdalUtils)
# To change the path to GDAL 
gdal_setInstallation(search_path = "C:\\Program Files\\QGIS 3.4\\bin", rescan = TRUE,
                     ignore.full_scan = TRUE, verbose = FALSE)

# To check the result
getOption("gdalUtils_gdalPath")[[1]]$path
#       [1] "C:/PROGRA~1/QGIS3~1.4/bin/"
getOption("gdalUtils_gdalPath")[[1]]$version
#       version 
#       "2.4.0" 

If this is possible, {sf} (and {stars}) package can use GDAL 2.4.0 under the hood of QGIS 3.4.


[Background]

In my previous question R stars package and set dimensions to a NetCDF file I leaned my issue was not reproducible in other environment. Now trying to see if change of environment can improve the situation. Upgrading GDAL version is the first step.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.