risk_layer.Rd
Compute a raster map from the input layer and rescale with a linear relationship.
risk_layer(x, boundaries, scale_target = c(0, 100))
a sf, sfc, SpatRaster or igraph object
a sf or sfc object, used to determine the boundaries of the computed risk layer.
numeric vector of length 2. New scale.
A SpatRaster object in the new scale.
For sf objects (geometries such as point, lines or polygons),
compute the distance_map()
, which gives a SpatRaster. For
igraph
objects (from network data), compute a SpatRaster
with the relative importance of the nearest node. For a SpatRaster
mask, extend or crop to the boundaries
as needed.
Finally, scale the SpatRaster outcome of any of the three input types. If you need an inverse relationship, just reverse the target scale.
ad <- mapMCDA_datasets()$animal.density
bd <- mapMCDA_datasets()$cmr_admin3
plot(ad)
plot(risk_layer(ad, bd, scale_target = c(-1, 1)))
plot(risk_layer(ad, bd, scale_target = c(1, -1)))