Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_boundaries

get_boundaries


Description

Get boundary cells of patches

Usage

get_boundaries(
  landscape,
  consider_boundary,
  edge_depth,
  as_NA,
  patch_id,
  return_raster
)

## S3 method for class 'RasterLayer'
get_boundaries(
  landscape,
  consider_boundary = FALSE,
  edge_depth = 1,
  as_NA = FALSE,
  patch_id = FALSE,
  return_raster = TRUE
)

## S3 method for class 'RasterStack'
get_boundaries(
  landscape,
  consider_boundary = FALSE,
  edge_depth = 1,
  as_NA = FALSE,
  patch_id = FALSE,
  return_raster = TRUE
)

## S3 method for class 'RasterBrick'
get_boundaries(
  landscape,
  consider_boundary = FALSE,
  edge_depth = 1,
  as_NA = FALSE,
  patch_id = FALSE,
  return_raster = TRUE
)

## S3 method for class 'stars'
get_boundaries(
  landscape,
  consider_boundary = FALSE,
  edge_depth = 1,
  as_NA = FALSE,
  patch_id = FALSE,
  return_raster = TRUE
)

## S3 method for class 'list'
get_boundaries(
  landscape,
  consider_boundary = FALSE,
  edge_depth = 1,
  as_NA = FALSE,
  patch_id = FALSE,
  return_raster = TRUE
)

get_boundaries_calc(landscape, consider_boundary, edge_depth, as_NA, patch_id)

Arguments

landscape

RasterLayer or matrix.

consider_boundary

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

edge_depth

Distance (in cells) a cell has the be away from the patch edge to be considered as core cell.

as_NA

If true, non-boundary cells area labeld NA.

patch_id

If true, boundary/edge cells are labeled with the original patch id.

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

List with RasterLayer or matrix

Examples

class_1 <- get_patches(landscape, class = 1)[[1]]

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

landscapemetrics

Landscape Metrics for Categorical Map Patterns

v1.5.2
GPL-3
Authors
Maximillian H.K. Hesselbarth [aut, cre] (<https://orcid.org/0000-0003-1125-9918>), Marco Sciaini [aut] (<https://orcid.org/0000-0002-3042-5435>), Jakub Nowosad [aut] (<https://orcid.org/0000-0002-1057-3721>), Sebastian Hanss [aut] (<https://orcid.org/0000-0002-3990-4897>), Laura J. Graham [ctb] (Input on package structure), Jeffrey Hollister [ctb] (Input on package structure), Kimberly A. With [ctb] (Input on package structure), Florian Privé [ctb] (Original author of underlying C++ code for get_nearestneighbour() function), Project Nayuki [ctb] (Original author of underlying C++ code for get_circumscribingcircle and lsm_p_circle), Matt Strimas-Mackey [ctb] (Bugfix in sample_metrics())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.