Create a list of xy coordinates from terra::xyFromCell coordinates
Source:R/random_walk.R
makeSourceList.RdCreate a list of xy coordinates from terra::xyFromCell coordinates
Arguments
- source_xy
An
sfobject with POINT geometry or a matrix with coordinate pairs (seeterra::xyFromCell)
Examples
if (FALSE) { # \dontrun{
source_areas<- rast("Dev/Data/classified_w7filter_source_areas.tif")
source_areas <- crop(source_areas, dem)
sum(values(source_areas), na.rm = TRUE)
# Find cells where the value is 1
source_cells <- which(values(source_areas) == 1)
source_xy <- xyFromCell(source_areas, source_cells)
source_l <- makeSourceList(source_xy)
} # }