
Create a dataframe that counts each patch independently for the prioritizr input
create_patch_df.RdThis function takes all of the inputs of prioritizr and creates
a dataframe precursor for prioritizr. This specific function includes the
use of "patches" which have been already generated by create_patches().
"Patches" are spatial groups of a particular feature, such as seamounts.
Prioritizr will protect entire patches to meet the protection goal for that
feature. The output of this function should be passed to
create_boundary_matrix() before being passed to prioritizr.
Usage
create_patch_df(
spatial_grid,
features,
patches,
costs = NULL,
locked_out = NULL,
locked_in = NULL
)Arguments
- spatial_grid
a raster or sf template with the desired resolution and coordinate reference system; values in areas of interest are 1, while all other values are NA
- features
a raster or sf object that includes all relevant features to be used in the prioritization; each layer of the raster or each column of the sf object identifies the location of each feature
- patches
a raster or sf object generated by
create_patches(); a single feature split into spatially distinct groups; each layer of the raster or each column of the sf object identifies the location of each patch- costs
a raster or sf object of the costs for protecting each cell in the planning grid
- locked_out
a raster or sf object for areas to be locked out (absolutely not protected) in the prioritization
- locked_in
a raster or sf object for areas to be locked in (absolutely protected) in the prioritization
Value
A data frame to be used as an input for create_boundary_matrix()
Examples
# Import some planning data
#import planning units/ cost raster
pu_raster <- terra::rast(system.file("extdata/pu_raster.tif", package = "patchwise"))
#import species distributions - feature data for planning
species_distributions <- terra::rast(system.file("extdata/spp_distributions.tif", package = "patchwise"))
#import seamounts
seamounts <- terra::rast(system.file("extdata/seamounts.tif", package = "patchwise"))
# Create seamount patches as multi-layer raster
patches_raster <- create_patches(seamounts)
patches_df <- create_patch_df(spatial_grid = pu_raster, features = species_distributions,
patches = patches_raster, costs = pu_raster)
#> Processing patch 1 of 3
#> Processing patch 2 of 3
#> Processing patch 3 of 3