nodata: Query raster files for their NoData values

Description Usage Arguments Value Examples

Description

Return the NoData value associated with one or more raster files.

Usage

1
nodata(srcfile, simplify = TRUE)

Arguments

srcfile

A character vector of file paths to the raster files to be queried.

simplify

Logical. If TRUE, then when all files referred to in srcfile have the same number of bands, the returned value will be simplified to an array (if srcfile refers to more than one file), or an atomic vector (if srcfile refers to a single file).

Value

A list with as many elements as the number of files specified in srcfile. Each list element contains a single vector whose values are the NoData values for each band of the corresponding raster file. If GDAL is unable to identify the NoData value, NA will be returned.

Examples

1
2
3
4
5
6
library(raster)
r <- raster(matrix(runif(100), ncol=10))
NAvalue(r) <- -9999
writeRaster(r, f <- tempfile(fileext='.tif'))
nodata(f)
nodata(c(f, f, f))

johnbaums/things documentation built on May 19, 2019, 3:03 p.m.