| rasterize {terra} | R Documentation |
Transfer vector data to a raster
## S4 method for signature 'SpatVector,SpatRaster' rasterize(x, y, field="", fun, ..., background=NA, touches=FALSE, update=FALSE, sum=FALSE, cover=FALSE, filename="", overwrite=FALSE, wopt=list())
x |
SpatVector |
y |
SpatRaster |
field |
character or numeric. If |
fun |
function, summarizing function that returns a single number; for when there are multiple points in one cell. For example |
... |
additional arguments passed to |
background |
numeric. Value to put in the cells that are not covered by any of the features of |
touches |
logical. If |
update |
logical. If |
sum |
logical. If |
cover |
logical. If |
filename |
character. Output filename |
overwrite |
logical. If |
wopt |
list with additional arguments for writing files as in |
SpatRaster
To update existing raster data use the output of rasterize as second argument in cover
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
r <- rast(v, ncols=75, nrows=100)
#x <- rasterize(v, r, "NAME_2")
#plot(x)
#lines(v)