get_geodist {wingen}R Documentation

Get a matrix of geographic distances for circle_gd

Description

Create a distance matrix based on coordinates and a raster layer. The output is a distance matrix where rows represent cells on the landscape and columns represent individual locations on the landscape. Each value is the geographic distance between each individual and each cell calculated using st_distance. This matrix is used by circle_gd. If coords_only = TRUE, the result is a distance matrix for the sample coordinates only.

Usage

get_geodist(coords, lyr = NULL, fact = 0, coords_only = FALSE)

Arguments

coords

coordinates of samples as sf points, a two-column matrix, or a data.frame representing x and y coordinates (see Details for important information about projections)

lyr

SpatRaster or RasterLayer for generating distances (not required if coords_only = TRUE)

fact

aggregation factor to apply to lyr (defaults to 0; note: increasing this value reduces computational time)

coords_only

whether to return distances only for sample coordinates

Value

a distance matrix used by circle_gd

Examples

load_mini_ex()
distmat <- get_geodist(mini_coords, mini_lyr)


[Package wingen version 2.1.2 Index]