landscapemetrics (version 1.4.4)

get_boundaries: get_boundaries

Description

Get boundary cells of patches

Usage

get_boundaries(landscape, directions, as_NA, consider_boundary, return_raster)

# S3 method for RasterLayer get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = TRUE )

# S3 method for RasterStack get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = TRUE )

# S3 method for RasterBrick get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = TRUE )

# S3 method for stars get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = TRUE )

# S3 method for list get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = TRUE )

# S3 method for matrix get_boundaries( landscape, directions = 4, as_NA = FALSE, consider_boundary = FALSE, return_raster = FALSE )

Arguments

landscape

RasterLayer or matrix.

directions

Rook's case (4 neighbours) or queen's case (8 neighbours) should be used as neighbourhood rule

as_NA

If true, non-boundary cells area labeld NA

consider_boundary

Logical if cells that only neighbour the landscape boundary should be considered as edge

return_raster

If false, matrix is returned

Value

List with RasterLayer or matrix

Details

All boundary/edge cells are labeled 1, all non-boundary cells 0. NA values are not changed. Boundary cells are defined as cells that neighbour either a NA cell or a cell with a different value than itself. Non-boundary cells only neighbour cells with the same value than themself.

Examples

Run this code
# NOT RUN {
class_1 <- get_patches(landscape, class = 1)[[1]]

get_boundaries(class_1)
get_boundaries(class_1, return_raster = FALSE)

class_1_matrix <- raster::as.matrix(class_1)
get_boundaries(class_1_matrix, return_raster = FALSE)

# }

Run the code above in your browser using DataLab