readTile: Read a collection of tif layers from a folder

Description Usage Arguments Value See Also Examples

Description

The function reads a collection of geotiffs from a folder and creates a single raster.stack object. It is used to streamline the input of many layers at once since Rgdal does not, at the time of this writing (15.Feb.2016) allow the direct processing of raster gdb files. Each layer should be in it's own geoTiff, although multiple bands within a geoTiff are allowed. Each file should be named with the layer name (see parameters). Optional labels can be supplied, but if no, need to be supplied for all layers.

Usage

1
readTile(rasterPath, layers, labels = NULL, NAval = NULL)

Arguments

rasterPath

path to the raster file

layers

a character list of layer names to read. The filename used will be '<layer[i]>.tif'

labels

(optional) a list of names for the columns of the final raster; will use layer names if this is not specified.

NAval

(optional) the value to be interpreted as NA; passed to raster::NAvalue

Value

a raster.stack of the objects in the folder

See Also

See the sample data egTile for an example, and the associated help for examples on how to generate derived data.

Examples

1
2
3
4
5
6
# Read egTile from the provided geoTiff's; gisPath must point to package installation folder.
path <- file.path(system.file("extdata", "egTile", package = "NPEL.Classification"),'')
egTile <- readTile(path, layers=c('base','grnns','wetns','brtns','dem','slp','asp','hsd'))

# Set the aspect layer to NA wherever slope is 0
egTile$asp <- calc (egTile$asp,fun=function(x){ x[x == -1] <- NA; x })

henkelstone/NPEL.Classification documentation built on May 17, 2019, 3:42 p.m.