Rasterize vector data
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="", ...)
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 |
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 |
... |
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, ncol=75, nrow=100) #x <- rasterize(v, r, "NAME_2") #plot(x) #lines(v)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.