Skip to contents

The purpose of boundary constraints is to limit a future projection within a specified area (such as for example a range or ecoregion). This can help to limit unreasonable projections into geographic space.

Similar to boundary constraints it is also possible to define a "zone" for the scenario projections, similar as was done for model training. The difference to a boundary constraint is that the boundary constraint is applied posthoc as a hard cut on any projection, while the zones would allow any projection (and other constraints) to be applied within the zone. Note: Setting a boundary constraint for future projections effectively potentially suitable areas!


add_constraint_boundary(mod, layer, ...)

# S4 method for BiodiversityScenario,sf
add_constraint_boundary(mod, layer, method = "boundary", ...)

# S4 method for BiodiversityScenario,ANY
add_constraint_boundary(mod, layer, method = "boundary", ...)



A BiodiversityScenario object with specified predictors.


A SpatRaster or sf object with the same extent as the model background. Has to be binary and is used for a posthoc masking of projected grid cells.


passed on parameters. See also the specific methods for adding constraints.


A character indicating the type of constraints to be added to the scenario. See details for more information.


if (FALSE) {
# Add scenario constraint
scenario(fit) |> add_constraint_boundary(range)