powered by
Transfer vector data to a raster
# S4 method for SpatVector,SpatRaster rasterize(x, y, field=1:nrow(x), background=NA, update=FALSE, filename="", overwrite=FALSE, wopt=list(), ...)
SpatVector
SpatRaster
numeric. The values to be rasterized. Either a single number, or a vector with the same length as x
x
numeric. Value for cells that are not covered by a polygon
logical. If TRUE the value in x are used except for cells covered by y
TRUE
y
character. Output filename. Optional
logical. If TRUE, filename is overwritten
filename
list. Options for writing files as in writeRaster
writeRaster
additional arguments. None implemented
# NOT RUN { f <- system.file("exdata/lux.shp", package="terra") v <- vect(f) r <- rast(v, ncol=75, nrow=100) x <- rasterize(v, r) plot(x) lines(v) # }
Run the code above in your browser using DataLab