raster.distance: Create distance layer.

View source: R/main.R

raster.distanceR Documentation

Create distance layer.

Description

Creates a layer depicting distances to records using the minimum, average, distance to the minimum convex polygon or distance taking into account a cost surface.

Usage

raster.distance(longlat, layers, type = "minimum")

Arguments

longlat

Matrix of longitude and latitude or eastness and northness (two columns in this order) of species occurrence records.

layers

Raster* object as defined by package raster to serve as model to create distance layer. Cost surface in case of param ="cost".

type

text string indicating whether the output should be the "minimum", "average", or "mcp" distance to all records. "mcp" means the distance to the minimum convex polygon encompassing all records.

Details

Using distance to records in models may help limiting the extrapolation of the predicted area much beyond known areas.

Value

A RasterLayer object.

Examples

layers = red.examples("red.layers")
alt = layers[[3]]
records = red.examples("red.records")
par(mfrow=c(3,2))
terra::plot(alt)
points(records)

terra::plot(raster.distance(records, alt))
terra::plot(raster.distance(records, alt, type = "average"))
terra::plot(raster.distance(records, alt, type = "mcp"))

red documentation built on Sept. 9, 2023, 1:07 a.m.

Related to raster.distance in red...