get_boundaries: get_boundaries

Description Usage Arguments Details Value Examples

Description

Get boundary cells of patches

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
get_boundaries(landscape, directions, as_NA, return_raster)

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

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

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

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

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

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

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

return_raster

If false, matrix is returned

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.

Value

RasterLayer or matrix

Examples

1
2
3
4
5
6
7
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)

r-spatialecology/landscapemetrics documentation built on May 20, 2019, noon