Description Usage Arguments Details Value Examples
Landscape metrics typically quantify spatial patterns of 2D lattices, such as maps of landscapes, artificial (spatial) patterns or even photographs.
1 2 
input 
[ 
with 
[ 
background 
[ 
simplify 
[ 
A landscape metric can be generic or derived. In the first case the
metric is a list that includes the operator
name and its arguments.
In the latter case these generic metrics are considered as terms,
while the derived metric is given as its mathematical equation, where the
terms are related to each other. You can find the equations for landscape
metrics in the vignette with vignette("landscape_metrics", package =
"rasterTools")
The following operators for generic metrics are defined:
mAdjacency
: Determine the adjacency matrix of a raster.
mArea
: Calculate the area of objects in a raster.
mNumber
: Count the number of objects in a raster.
mPerimeter
: Calculate the length of the boundary of objects
in a raster.
mValues
: Summarise the values of objects
in a raster.
depending on the employed metric, but typically a data.frame
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  input < rtData$categorical
# calculate generic metrics 'area per class' and 'area per landscape', 'obj' does
# not need to be specified per operator in the algorithm, as 'measure' assigns it.
myMetrics < list(a_c = list(operator = "mArea", scale = "class"),
a_l = list(operator = "mArea", scale = "landscape"))
(measure(input = input, with = myMetrics))
# calculate 'class proportional area' and 'largest patch index'
# 1) define the terms (generic metrics) that are needed to compute the metrics
# 2) define the equations that are used based on these terms
myMetrics < list(a_p = list(operator = "mArea", scale = "patch"),
a_c = list(operator = "mArea", scale = "class"),
a_l = list(operator = "mArea", scale = "landscape"),
mCPA = "a_c / a_l * 100",
mLPI = "max(a_p) / a_l * 100")
(measure(input = input, with = myMetrics, simplify = FALSE))
# however, in the above example patches are derived per class, which might
# not make sense ecologically, or be at best arbitrary. Instead we might
# want to treat all forest, irrespective of deciduous or coniferous as one
# patch.
substituted < rSubstitute(input, old = c(41:47), new = 40)
visualise(raster::stack(input, substituted))
# now we can get perhaps more reasonable data in a simplified table
(measure(input = substituted, with = myMetrics))
# To come: set of spatial operations that enables more complex metrics
# derive 'Disjunct Cores Density', which is a rather complex metric

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.