mArea: Area of objects

Description Usage Arguments Value See Also Examples

View source: R/measure.operators.R

Description

Calculate the area of objects in a raster

Usage

1
mArea(obj, scale = "patch", unit = "cells", layer = NULL)

Arguments

obj

[Raster*(1)]
The object to measure.

scale

[character(1)]
scale at which the area of objects should be calculated; possible values are "patch", "class" and "landscape".

unit

[character(1)]
the unit the output should have. With "map" the result will be in the respective map unit and with "cells" (default) it will be the number of raster cells.

layer

[character(1)]
in case obj has several layers, specify here the layer for which the area of objects shall be calculated (by default, the first layer).

Value

For scale = "landscape" the area of the overall raster, for scale = "class" the total area of each unique value (class), for scale = "patch" the area of distinct objects per distinct values (i.e. the area of patches per class).

See Also

Other generic metrics: mAdjacency, mNumber, mPerimeter, mValues

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cat <- rtRasters$categorical
bin <- rBinarise(rtRasters$continuous, thresh = 40)

# the area ...
# ... per landcover type
mArea(obj = cat, scale = "class")

# ... of patches per landcover type
mArea(obj = cat, scale = "patch")

# ...  of certain values; from a binary raster, patches are 
# automatically determined
require(magrittr)
rBinarise(obj = cat, match = c(41, 44, 47)) %>%
  mArea(scale = "patch", layer = "values_binarised")

mArea(obj = bin, scale = "class")

EhrmannS/rasterTools documentation built on Sept. 4, 2019, 10:34 a.m.