Skip to contents

Reads a raster file from the specified path. The function checks if the file exists and if it is a valid raster file (tif, tiff, png).

Usage

read_raster_file(x)

Arguments

x

A character string specifying the path to the raster file.

Value

A SpatRaster object representing the raster data.

Examples

#> Warning: '/tmp/RtmpZD76sq/RISKINTRODATA_CACHE_DIR' already exists
#> Warning: cannot open file '/home/runner/Documents/skintrodata_dummy_setup.txt': No such file or directory
#> Error in file(con, "w"): cannot open the connection
if (curl::has_internet()) {
  road_access_raster_file <- download_road_access_raster()
  ra_raster <- read_raster_file(x = road_access_raster_file)
}