clouds_tree_metrics | R Documentation |
Extracts summary statistics on trees for each LAS object in a list:
clouds_tree_metrics(llasn, XY, plot_radius, res = 0.5, roi = NULL, func, ...)
llasn |
list of |
XY |
a data frame or matrix with XY coordinates of plot centers |
plot_radius |
numeric. plot radius in meters |
res |
numeric. resolution of canopy height model computed with
|
roi |
sf object. polygons corresponding to plot shapes. Only trees which apices are inside the polygons are retained for subsequent computations. However, plot surface is still computed as pi * plot_radius^2 |
func |
a function to be applied to the attributes of extracted trees
(return from internal call to |
... |
other parameters to be passed to |
calls tree_segmentation
to segment trees and then
tree_extraction
to extract their features
computes 'TreeCanopy_cover_in_plot' (proportion of surface of disk of interest which is covered by segmented trees), 'TreeCanopy_meanH_in_plot' (mean canopy height inside intersection of tree segments and disk of interest)
removes detected trees located outside of the disk of interest defined by their centers and radius
computes summary statistics of extracted tree features based on a
user-defined function (default is std_tree_metrics
)
a data frame with tree metrics in columns corresponding to LAS objects of the list (lines)
tree_segmentation
, tree_extraction
,
std_tree_metrics
# load LAS file
LASfile <- system.file("extdata", "las_chablais3.laz", package="lidaRtRee")
las_chablais3 <- lidR::readLAS(LASfile)
# set number of threads
lidR::set_lidr_threads(2)
# extract two point clouds from LAS object
llas <- lidR::clip_circle(las_chablais3,
c(974350, 974390),
c(6581680, 6581680), 10)
# normalize point clouds
llas <- lapply(llas, function(x) {
lidR::normalize_height(x, lidR::tin())
})
# compute metrics with user-defined function
# number of detected trees between 20 and 30 meters and their mean height
# restricted to disks of radius 8 m.
user_func <- function(x) {
dummy <- x$h[which(x$h > 20 & x$h < 30)]
data.frame(Tree.between.20.30 = length(dummy), Tree.meanH = mean(dummy))
}
XY <- data.frame(X = c(974350, 974390),
Y = c(6581680, 6581680))
clouds_tree_metrics(llas,
XY,
8,
res = 0.5,
func = user_func
)
#
# same result using a user-input circular roi
roi <- sf::st_as_sf(XY,
coords = c("X", "Y"),
crs = sf::st_crs(2154)
)
roi <- sf::st_buffer(roi, 8)
clouds_tree_metrics(llas,
XY,
8,
roi = roi,
res = 0.5,
func = user_func
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.