multiscale_feature_cols: Retrieve feature columns for multiscale optimization

View source: R/load-multiscale-feature.R

multiscale_feature_colsR Documentation

Retrieve feature columns for multiscale optimization

Description

Returns the multiscale feature columns created by load_multiscale_feature() in a named vector that can be passed directly to the feature_cols argument of build_multiscale_objective_data().

Usage

multiscale_feature_cols(pu, names_as = c("native", "feature"))

Arguments

pu

A planning-unit object containing a multiscale_features attribute.

names_as

Character; use "native" to name the returned vector with native feature columns, or "feature" to use feature names.

Details

With names_as = "native", the vector is named using the native feature columns, such as r8_habitat. With names_as = "feature", it is named using the feature names supplied to load_multiscale_feature().

Value

A named character vector mapping native feature columns or feature names to their corresponding multiscale feature columns.

See Also

Other multiscale minimum-set: add_multiscale_min_set(), add_multiscale_min_set_objective(), add_multiscale_relative_targets(), build_multiscale_atoms(), build_multiscale_feature_atoms(), build_multiscale_objective_data(), eval_multiscale_atom_solution(), load_multiscale_feature()

Examples

parent <- "872a1072bffffff" # Create one H3 parent and one of its children.
child <- h3jsr::get_children(parent, 8L, simple = TRUE)
child <- as.character(unlist(child, use.names = FALSE))[1]

h3_vec <- c(parent, child)

pu <- h3jsr::cell_to_polygon(h3_vec, simple = FALSE)
pu <- pu[match(h3_vec, pu$h3_address), ]
pu$res <- c(7L, 8L)

maps <- build_h3_maps(pu,res_levels = c(7L, 8L))

feature <- sf::st_sf(geometry = sf::st_geometry(pu[2, ]))

pu <- load_multiscale_feature(pu = pu,source = feature,
  native_res = 8L,maps = maps,feature_name = "habitat")

# Map native feature columns to optimization columns.
multiscale_feature_cols(pu)


MultiscaleSCP documentation built on Oct. 14, 2026, 5:07 p.m.