Learn R Programming

red (version 0.2.0)

raster.read: Read and buffer raster layers.

Description

Read raster layers of environmental or other variables and crop them to a given extent around the known occurrences.

Usage

raster.read(longlat, layers = NULL, ext = 1)

Arguments

longlat
Matrix of longitude and latitude (two columns) of species occurrence records.
layers
Raster* object as defined by package raster.
ext
Buffer around the known records used to crop layers. It is relative to the maximum distance between any two records.

Value

A RasterStack object (Variables 1-19 = bioclim, 20 = elevation, 21-32 = proportion landcover, 33 = most common landcover).

Details

If layers are not given, the function will read either 1 arc-minute (approx. 2km) or 5 arc-minutes (approx. 10km) resolution rasters from worldclim (Hijmans et al. 2005) and landcover (Tuanmu & Jetz 2014) if these are provided in the data folder of the package (see read.me file on how to do it).

Examples

Run this code
data(data.layers)
data(data.records)
par(mfrow=c(1,2))
raster::plot(data.layers[[1]])
points(data.records)
croppedLayers <- raster.read(data.records, data.layers, 0.1)
raster::plot(croppedLayers[[1]])
points(data.records)

Run the code above in your browser using DataLab