R/parks_calc_attributes_helpers.R
raster_edge_length.Rd
Helper function within parks_calc_attributes()
.
The total edge length of (classified) raster patches contained within
the polygons
will be calculated. Additionally, the argument raster_edge_buffer
provides a way include patches
in close proximity to the polygons
. The total edge lengths are summed together and appended to the polygons
data as additional columns (or one column, if there is only one raster class).
Note that this operation may take a while to complete, as it involves the conversion of rasters to polygons (and vice versa).
sf
(with projected coordinate reference system).
SpatRaster
object from terra::rast()
. Should have a (projected) coordinate reference system similar to polygons
.
Minimum patch size to be included in results.
Provided either as a units object (see units::set_units()
),
or a number in the units of the coordinate reference system. Defaults to 0
m^2.
numeric. Specify buffer distance to add to polygonised raster; the total edge length of polygons
that
intersect the buffered raster
will be summed up together with the total edge length contained within the polygons
.
Defaults to 0
(only patches fully contained within polygons will be considered).
Provided either as a units object (see units::set_units()
), or a number in the units of the coordinate reference system.
logical. Whether or not to calculate relative amounts
(i.e. ratio of edge-to-perimeter length). Defaults to TRUE
.
polygons
with added column(s) < class value >_length
, and < class value >_length_perim_ratio
if relative
is set to TRUE
.
Note that the value 0
will be summarised; convert pixels to NA
if you wish to exclude them.