The function checks that GDAL is installed and updated to the minimum required version (2.1.2).

check_gdal(abort = TRUE, gdal_path = NULL, force = FALSE, full_scan = FALSE)



Logical parameter: if TRUE (default), the function aborts in case no GDAL installation is found; if FALSE, a warning is shown and FALSE is returned.


(optional) Character: the path in which GDAL must be searched in. If NULL (default), search is performed in the whole file system.


(optional) Logical: if TRUE, install even if it is already installed (default is FALSE). Notice that, defining gdal_path, GDAL is searched again even if "force" = FALSE in case the existing installation is not in gdal_path.


(optional) Logical: in Linux and MacOS, if gdal_path was not manually defined, GDAL is searched within the system path in case this argument is left to default value FALSE; instead, if TRUE, a full search is performed. In Windows, if the default OSGeo directory C:\\OSGeo4W64 exists, GDAL is searched there, otherwise in the main directory C:\\; setting full_scan to TRUE, is is always searched in the whole C:\\. This argument takes no effect if gdal_path was defined, since, in that case, a full search is always performed in gdal_path.


Logical (invisible): TRUE in case the installation is ok, FALSE if GDAL is missing and abort=FALSE (otherwise, the function stops).


License: GPL 3.0


L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. doi:10.1016/j.cageo.2020.104473 , URL:


Luigi Ranghetti, phD (2019)


if (FALSE) {