get_geodist | R Documentation |
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.
get_geodist(coords, lyr = NULL, fact = 0, coords_only = FALSE)
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 |
coords_only |
whether to return distances only for sample coordinates |
a distance matrix used by circle_gd
load_mini_ex()
distmat <- get_geodist(mini_coords, mini_lyr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.