point2rast | R Documentation |
Points to raster nearest neighbour interpolation
point2rast(
data,
spatobj,
loc = c("x", "y"),
cellsize,
nnmax = 4,
as = c("SpatRast", "SpatVect")
)
data |
Vector, dataframe, or spatial (class: 'Spatial' or 'sf') input data to use for interpolation |
spatobj |
Spatial object used to create extent for output raster |
loc |
Vector of coordinate variable names or matrix of coordinates |
cellsize |
Output raster cell size |
nnmax |
Nearest neighbour maximum neighbours used for interpolation |
as |
Output as raster 'SpatRast' or vector 'SpatVect' |
A terra SpatRaster or SpatVector object
Travis Tai
## Not run:
dat <- data.frame(x = runif(5, 0, 10), y = runif(5, 0, 10), var = rnorm(5))
extent <- st_bbox(c(xmin = 0, ymin = 0, xmax= 10, ymax = 10),crs = NA)
output <- point2rast(dat, extent, loc = c("x","y"), cellsize = 0.5, nnmax = 2, as = "SpatRast")
output
plot(output)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.