Learn R Programming

spatialEco (version 0.1-2)

land.metrics: Landscape metrics for points and polygons

Description

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

Usage

land.metrics(x, y, bkgd = NA, metrics = c(4, 14, 33, 34, 35, 37, 38),
  bw = 1000, latlon = FALSE, Trace = TRUE)

Arguments

x
SpatalPointsDataFrame or SpatalPolgonsDataFrame class object
y
raster class object (binary raster)
bkgd
Background value
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)

Value

  • data.frame with specified metrics in columns. The data.frame is ordered the same as the input feature class and can be directly joined to the @data slot

Examples

Run this code
library(raster)
library(sp)
r <- raster(ncol=1000, nrow=1000)
  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)

land.metrics(x=x, y=r, bw=0.72, bkgd = 0, latlon = TRUE, Trace = FALSE)

Run the code above in your browser using DataLab