Compute a raster map from the input layer and rescale with a linear relationship.

risk_layer(x, boundaries, scale_target = c(0, 100))

## Arguments

x a Spatial*, RasterLayer or igraph object a Spatial* object, used to determine the boundaries of the computed risk layer. numeric vector of length 2. New scale.

## Value

A RasterLayer object in the new scale.

## Details

For Spatial* objects (geometries such as point, lines or polygons), compute the distance_map(), which gives a RasterLayer. For igraph objects (from network data), compute a RasterLayer with the relative importance of the nearest node. For a RasterLayer mask, extend or crop to the boundaries as needed.

Finally, scale the RasterLayer outcome of any of the three input types. If you need an inverse relationship, just reverse the target scale.

## Examples

  ad <- mapMCDA_datasets()$animal.density bd <- mapMCDA_datasets()$cmr_admin3
raster::plot(ad)  raster::plot(risk_layer(ad, bd, scale_target = c(-1, 1)))  raster::plot(risk_layer(ad, bd, scale_target = c(1, -1)))