Returns the coordinates of the center of cells of a GRaster
or coordinates of a GVector
's vertices. The output will be a matrix
, data.frame
, or list
. If you want the output to be a "points" GVector
, use as.points()
.
Examples
if (grassStarted()) {
# Setup
library(terra)
# Plant specimens (points), elevation (raster)
madDypsis <- fastData("madDypsis")
madElev <- fastData("madElev")
# Convert a SpatRaster to a GRaster, and sf to a GVector
dypsis <- fast(madDypsis)
elev <- fast(madElev)
### Get coordinates:
dypsisPoints <- crds(dypsis)
elevPoints <- crds(elev)
head(dypsisPoints)
head(elevPoints)
}