| eval_exact_raster_coverage | R Documentation |
Calculate how well raster-based features are represented by a selected set of planning units.
This function evaluates feature coverage from raster layers using exact area-weighted extraction. For each feature, it calculates the total amount available within its native-resolution planning unit footprint, the amount held by the selected planning units, and the proportion of the feature represented by the solution.
If targets are provided, the function also reports absolute and relative shortfalls from those targets.
eval_exact_raster_coverage(
spp_all,
pu_sf,
solution_col,
targets = NULL,
res_col = "res"
)
spp_all |
A |
pu_sf |
Planning units as an |
solution_col |
Name of the 0/1 (or logical) selection column in |
targets |
Optional named numeric vector of RELATIVE targets (proportions in |
res_col |
Name of the resolution column in |
A data frame with columns:
feature
native_res
total_area Total feature amount within the native-resolution domain (area-integral units).
held_area Feature amount held by the selected area, restricted to that domain (area-integral units).
relative_held Relative held amount (held_area / total_area).
target Relative target proportion (if targets supplied).
absolute_shortfall Absolute shortfall in feature units (\max(0, target * total\_area - held\_area)).
relative_shortfall Relative shortfall in proportions (\max(0, target - relative\_held)).
# Tiny raster with a single layer named with r7_ prefix
r <- terra::rast(nrows = 2, ncols = 2, xmin = 0, xmax = 2, ymin = 0, ymax = 2)
terra::values(r) <- 1
names(r) <- "r7_featA"
# One square PU covering the raster
pu <- sf::st_sf(
res = 7L,
selected = 1L,
geometry = sf::st_sfc(
sf::st_polygon(list(rbind(c(0, 0), c(2, 0), c(2, 2), c(0, 2), c(0, 0)))),
crs = 4326
)
)
eval_exact_raster_coverage(
spp_all = r,
pu_sf = pu,
solution_col = "selected",
targets = c(r7_featA = 0.3),
res_col = "res"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.