Skip to contents

Invert a vector layer according to the extent of a restopt problem.

Usage

invert_vector(vector_layer, extent = NULL, filter = NULL)

Arguments

vector_layer

terra::vect() Vector layer.

extent

SpatExtent Optional: you can specify another extent as the input vector layer extent for the inversion.

filter

Optional: filter to apply to x. Leave NULL for no filtering.

Value

A terra::vect() Vector object.

Details

Invert a vector layer according to its extent, or a user-specified extent. This function is useful to derive locked out areas from accessible areas, e.g. buffer around tracks.

Examples

# \donttest{
habitat_data <- rast(
  system.file("extdata", "habitat_hi_res.tif", package = "restoptr")
)
available <- vect(
  system.file("extdata", "accessible_areas.gpkg", package = "restoptr")
)
locked_out <- invert_vector(
  vector_layer = available,
  extent = ext(habitat_data),
  filter = available$ID==2
)
# }