get_perimeter_patch: get_perimeter_patch

View source: R/prepare_extras.R

get_perimeter_patchR Documentation

get_perimeter_patch

Description

Perimeter of each patch in each class

Usage

get_perimeter_patch(classes, class_patches, resolution)

Arguments

classes

A vector with unique values (output of get_unique_values_int)

class_patches

A list with matrices of patches for each class (output of get_class_patches)

resolution

A vector with two numbers (usually calculated using terra::res)

Details

Calculate perimeter of each patch in each class

Value

A tibble with two columns: class, value

Examples

landscape <- terra::rast(landscapemetrics::landscape)
landscape_mat <- terra::as.matrix(landscape, wide = TRUE)
classes <- landscapemetrics:::get_unique_values_int(landscape_mat)
class_patches <- get_class_patches(landscape_mat, classes, directions = 8)
pp <- get_perimeter_patch(classes, class_patches, terra::res(landscape))


landscapemetrics documentation built on Sept. 12, 2024, 7:42 a.m.