| distValues | R Documentation |
For each cell, compute the distance in value-space to reference values. References are a matrix or data.frame whose columns match the layer names of x, or a SpatVector of locations from which values are extracted.
## S4 method for signature 'SpatRaster,matrix'
distValues(x, y, fun="squared", weights=NULL, ...,
filename="", overwrite=FALSE, wopt=list())
## S4 method for signature 'SpatRaster,data.frame'
distValues(x, y, fun="squared", weights=NULL, ...,
filename="", overwrite=FALSE, wopt=list())
## S4 method for signature 'SpatRaster,SpatVector'
distValues(x, y, fun="squared", center=FALSE, scale=FALSE,
weights=NULL, ..., filename="", overwrite=FALSE, wopt=list())
x |
SpatRaster |
y |
matrix, data.frame, or SpatVector |
fun |
character. |
weights |
numeric. Optional weights for the layers of |
center |
logical or numeric. Passed to |
scale |
logical or numeric. Passed to |
... |
additional arguments passed to |
filename |
character. Output filename |
overwrite |
logical. If |
wopt |
additional arguments for writing files as in |
SpatRaster
bestMatch, scale
r <- rast(system.file("ex/logo.tif", package="terra"))
pts <- vect(cbind(c(25.25, 34.324), c(54.577, 46.489)))
x <- scale(r)
d <- distValues(x, pts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.