| eval_geom_feature_coverage | R Documentation |
Calculate how well features are represented by a selected set of planning units.
This function evaluates feature coverage using feature values stored directly in planning unit attributes. For each feature, it calculates the total amount available, 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.
Feature coverage is calculated using fractional overlap between planning units and the union of selected planning units.
eval_geom_feature_coverage(
s,
flag_col = "selected_by_resolution",
feature_cols,
res_col = "res",
targets = NULL
)
s |
An |
flag_col |
Name of the 0/1 selection column in |
feature_cols |
Character vector of feature column names in |
res_col |
Name of the resolution column in |
targets |
Optional named numeric vector of RELATIVE targets (proportions in |
A tibble with one row per feature and columns:
feature, native_res
total Total feature amount across all PUs at the native resolution.
held Feature amount held by the selected area (via fractional overlap), restricted to the native-resolution footprint.
rel_held Relative held amount (held / total).
target Relative target proportion (if targets supplied).
abs_shortfall Absolute shortfall in feature units (\max(0, target * total - held)).
rel_shortfall Relative shortfall in proportions (\max(0, target - rel\_held)).
# Minimal polygons
p1 <- sf::st_polygon(list(rbind(c(0, 0), c(1, 0), c(1, 1), c(0, 1), c(0, 0))))
p2 <- sf::st_polygon(list(rbind(c(1, 0), c(2, 0), c(2, 1), c(1, 1), c(1, 0))))
s <- sf::st_sf(
res = c(7L, 7L),
area_km2 = c(1, 1),
selected_by_resolution = c(1L, 0L),
r7_featA = c(10, 5),
geometry = sf::st_sfc(p1, p2, crs = 4326)
)
eval_geom_feature_coverage(
s,
flag_col = "selected_by_resolution",
feature_cols = "r7_featA",
res_col = "res"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.