distance {gecko}R 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

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

Arguments

longlat

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

layers

SpatRaster. As defined in package terra, see terra::rast(). To serve as model to create distance layer.

type

character. 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

SpatRaster.

Examples

userpar <- par(no.readonly = TRUE) 
region = gecko.data("layers")
alt = region[[3]]
localities = gecko.data("records")
par(mfrow=c(3,2))
terra::plot(alt)
points(localities)
terra::plot(distance(localities, alt))
terra::plot(distance(localities, alt, type = "average"))
par(userpar)

[Package gecko version 1.0.0 Index]