Efficient Attribute-Weighted Rasterization Using Coverage Fraction
exact_rasterise.RdRasterizes vector features to a raster grid defined by a planning unit (pus) layer,
assigning values based on a given attribute and the actual coverage fraction of
each feature over each raster cell. This method is optimized for speed and precision
and is especially useful when features overlap or vary in size and shape.
Uso
exact_rasterise(
features,
attribute,
iso3,
pus,
invert = FALSE,
rescaled = TRUE,
fun = mean,
cores = 4
)Argumentos
- features
An
sforSpatVectorobject containing the vector features to rasterize.- attribute
Character. The column name in
featuresto use as a weight for raster values.- iso3
Character. ISO3 country code, passed to
make_normalised_raster().- pus
A
SpatRasterobject defining the resolution, extent, and CRS of the output raster.- invert
Logical. If
TRUE, inverts the resulting values during normalization (default:FALSE).- rescaled
Logical. If
TRUE, rescales the output to 0-1 usingmake_normalised_raster()(default:TRUE).- fun
Function. Aggregation function applied across overlapping rasterized features (default:
mean).- cores
Integer. Number of CPU cores to use for multi-core processing (default: 4).