View source: R/get_circumscribingcircle.R
get_circumscribingcircle | R Documentation |
Diameter of the circumscribing circle around patches
get_circumscribingcircle(landscape, directions = 8, level = "patch")
landscape |
SpatRaster or matrix (with x, y, id columns) |
directions |
The number of directions in which patches should be connected: 4 (rook's case) or 8 (queen's case). |
level |
Either 'patch' or 'class' for the corresponding level. |
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.
Because the metric is based on distances or areas please make sure your data
is valid using check_landscape
.
Based on C++ code from Project Nayuki (https://www.nayuki.io/page/smallest-enclosing-circle).
landscape <- terra::rast(landscapemetrics::landscape)
# get circle around each patch
get_circumscribingcircle(landscape)
# get circle around whole class
get_circumscribingcircle(landscape, level = "class")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.