Learn R Programming

landscapemetrics (version 1.1)

get_circumscribingcircle: get_circumscribingcircle

Description

Diameter of the circumscribing circle around patches

Usage

get_circumscribingcircle(landscape, resolution_x, resolution_y)

# S3 method for RasterLayer get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

# S3 method for RasterStack get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

# S3 method for RasterBrick get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

# S3 method for stars get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

# S3 method for list get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

# S3 method for matrix get_circumscribingcircle(landscape, resolution_x = NULL, resolution_y = NULL)

Arguments

landscape

RasterLayer or matrix (with x, y, id columns)

resolution_x

Resolution of the landscape (only needed if matrix as input is used)

resolution_y

Resolution of the landscape (only needed if matrix as input is used)

Details

The diameter of the smallest circumscribing circle around a patch in the landscape is based on the maximum distance between the corners of each cell. This ensures that all cells of the patch are included in the patch. All patches need an unique ID (see get_patches). If one uses this functions with a matrix the resolution of the underlying data must be provided.

Examples

Run this code
# NOT RUN {
# get patches for class 1 from testdata as raster
class_1 <- get_patches(landscape, class = 1)[[1]]

# calculate the minimum circumscribing circle of each patch in class 1
get_circumscribingcircle(class_1)

# do the same with a 3 column matrix (x, y, id)
class_1_matrix <- raster::rasterToPoints(class_1)
get_circumscribingcircle(class_1_matrix, resolution_x = 1, resolution_y = 1)

# }

Run the code above in your browser using DataLab