Skip to contents

A lightweight diagnostic that tries to open the specified path via GDAL and returns TRUE if successful, FALSE if GDAL cannot open it. Stops with an informative error if the package was built without GDAL support.

Usage

gdal_can_open(path)

Arguments

path

Character string: path to the raster file.

Value

Logical TRUE if GDAL can open the file, FALSE otherwise.

Examples

# \donttest{
if (has_gdal()) {
  gdal_can_open(system.file("extdata", "tiny.tif", package = "xbioclim"))
}
#> Warning: GDAL Error 4: /tmp/RtmpRzND6Y/file31e66f3fb248.tif: No such file or directory
#> [1] TRUE
# }