land.metrics: Landscape metrics for points and polygons

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/land.metrics.R

Description

Calculates a variety of landscape metrics, on binary rasters, for polygons or points with a buffer distance

Usage

1
2
land.metrics(x, y, bkgd = NA, metrics = c("prop.landscape"), bw = 1000,
  latlon = FALSE, trace = TRUE)

Arguments

x

SpatalPointsDataFrame or SpatalPolgonsDataFrame class object

y

raster class object

bkgd

Background value (will be ignored)

metrics

Numeric index of desired metric (see available metrics)

bw

Buffer distance (ignored if x is SpatalPolgonsDataFrame)

latlon

Is raster data in lat-long (TRUE/FALSE)

trace

Plot raster subsets and echo object ID at each iteration (TRUE | FALSE)

Details

The following metrics are available:

Value

If multiple classes are evaluated a list object with a data.frame for each class containing specified metrics in columns. The data.frame is ordered and shares the same row.names as the input feature class and can be directly joined to the @data slot. For single class problems a data.frame object is returned.

Note

Modifications to the function incorporate multi-class metrics by fetching the unique values of the raster and creating a list object containing a data.frame for each class. Unfortunately, retrieving unique values is a very slow function.

depends: sp, raster, rgeos, SDMTools

Author(s)

Jeffrey S. Evans <[email protected]>

See Also

focal.lmetrics

ConnCompLabel

PatchStat

ClassStat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 library(raster)
 library(sp)

 r <- raster(nrows=180, ncols=360, xmn=571823.6, xmx=616763.6, ymn=4423540, 
             ymx=4453690, resolution=270, crs = CRS("+proj=utm +zone=12 +datum=NAD83 
             +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"))

 r[] <- rpois(ncell(r), lambda=1)
 r <- calc(r, fun=function(x) { x[x >= 1] <- 1; return(x) } )  
 x <- sampleRandom(r, 10, na.rm = TRUE, sp = TRUE)

 lmet <- c("prop.landscape", "edge.density", "prop.like.adjacencies", "aggregation.index") 
 ( class.1 <- land.metrics(x=x, y=r, bw=1000, bkgd = 0, metrics = lmet) )
 ( all.class <- land.metrics(x=x, y=r, bw=1000, bkgd = NA, metrics = lmet ) )

 # Pull metrics associated with class "0"
 all.class[["0"]]

spatialEco documentation built on Dec. 8, 2017, 1:05 a.m.