Learn R Programming

mkde (version 0.4)

computeAreaRaster: Calculate cell areas from elevation raster.

Description

A lower-level function for calculating a cell area matrix (2D array) from an elevation matrix. The area is based on the surface area of the terrain in the cell. The area matrix is then used in calculating areas of 2.5D MKDES.

Usage

computeAreaRaster(RelevMatrix, RcellSize)

Value

A 2D matrix of cell surface areas.

Arguments

RelevMatrix

A 2D array with elevation values.

RcellSize

Size of the cells. It is assumed to be the same in the x and y dimensions.

Author

Jeff A. Tracey, PhD
USGS Western Ecological Research Center, San Diego Field Station
jatracey@usgs.gov
James Sheppard, PhD
San Diego Zoo Institute for Conservation Research
jsheppard@sandiegozoo.org

Details

This is a wrapper function for C++ function that calculates the surface area of each raster cell given the cell elevations. It is not intended to be used directly; instead, the user should call initializeAreaRaster on an MKDE object.

References

Jenness J.S. (2004) Calculating landscape surface area from digital elevation models. Wildlife Society Bulletin 32: 829-839.
Jenness, J.S. (2014) Calculating landscape surface area from unprojected digital elevation models. In preparation.

Examples

Run this code
library(terra)
fpath <- system.file("extdata", "condordem.RDS", package="mkde")
condordem <- terra::readRDS(fpath)
cell.sz <- mean(res(condordem))
area.rast <- computeAreaRaster(as.matrix(condordem, wide=TRUE), cell.sz)

Run the code above in your browser using DataLab