calculate_distance {ElevDistr} | R Documentation |
Sample and calculate the distance to the local treeline
Description
Points are uniformly drawn along polygons that specify the treeline. The elevation of each point is then extracted
and the median elevation of all points is calculated. Finally the median treeline elevation is subtracted from the
pointElevation
to get its distance to the local treeline.
Usage
calculate_distance(treeline, elevationRaster, pointElevation, treelineSampling = 10,
plot = FALSE)
Arguments
treeline |
A data frame containing line-shaped polygons. Each row containing: a identifier, a start latitude and longitude, an end latitude and longitude. All longitude and latitude (WGS 84) parameters must be of the data type "numeric" and finite. |
elevationRaster |
Raster that contains a digital elevation model. Data type "SpatRaster". |
pointElevation |
Elevation of the point of interest (in meters above the sea level). One value, data type "numeric" and finite. |
treelineSampling |
A constant number of samples taken from one "treeline piece". One value, data type "integer", finite and not zero. |
plot |
Boolean that defines if a histogram of the sampled elevation is plotted.
The plot will only be shown if the value is |
Value
Returns a numeric representing the vertical distance to the local treeline in meters.
Author(s)
Livio Bätscher, Jurriaan M. de Vos
Examples
## Not run:
calculate_distance(treeline = dfTreeline, elevationRaster = GTOPO30, pointElevation = 512,
treelineSampling = 10, plot = FALSE)
## End(Not run)