interpNear | R Documentation |
Nearest neighbor interpolation of points, using a moving window
## S4 method for signature 'SpatRaster,SpatVector'
interpNear(x, y, field, radius, interpolate=FALSE, fill=NA, filename="", ...)
## S4 method for signature 'SpatRaster,matrix'
interpNear(x, y, radius, interpolate=FALSE, fill=NA, filename="", ...)
x |
SpatRaster |
y |
SpatVector or matrix with three columns (x,y,z) |
field |
character. field name in SpatVector |
radius |
numeric. The radius of the circle (single number). If |
interpolate |
logical. Should the nearest neighbor values be linearly interpolated between points? |
fill |
numeric. value to use to fill empty cells |
filename |
character. Output filename |
... |
additional arguments for writing files as in |
SpatRaster
rasterizeWin, rasterize, interpIDW, interpolate
r <- rast(ncol=100, nrow=100, crs="local", xmin=0, xmax=50, ymin=0, ymax=50)
set.seed(100)
x <- runif(25, 5, 45)
y <- runif(25, 5, 45)
z <- sample(25)
xyz <- cbind(x,y,z)
x <- interpNear(r, xyz, radius=5)
p <- vect(data.frame(xyz), geom=c("x", "y"))
v <- voronoi(p)
plot(x, col=rainbow(25))
lines(v)
# plot(v, col=rainbow(25)); points(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.