tree_metrics

0th

Percentile

Compute metrics for each tree

Once the trees are segmented with lastrees, computes a series of descriptive statistics defined by the user for each individual tree. The output is a table in which each line is a tree, and each column is a metric. tree_metrics is similar to lasmetrics or grid_metrics or grid_metrics3d or grid_hexametrics, except it computes metrics for each segmented tree.

Usage
tree_metrics(.las, func, debug = FALSE)
Arguments
.las

An object of class LAS.

func

The function to be applied to each tree.

debug

logical. When facing a non trivial error, try debug = TRUE.

Details

The following existing functions contain a small set of pre-defined metrics:

Users must write their own functions to create their own metrics. tree_metrics will dispatch the LiDAR data for each segmented tree in the user-defined function. Functions are defined without the need to considering each segmented tree i.e. only the point cloud (see examples).

Value

Returns a data.table containing the metrics for each segmented tree.

Aliases
  • tree_metrics
Examples
# NOT RUN {
LASfile <- system.file("extdata", "Tree.laz", package="lidR")
las = readLAS(LASfile, filter = "-drop_z_below 0")

# segment trees (see lastrees)
lastrees(las, algorithm = "li2012")

# Max height for each tree
tree_metrics(las, mean(Z))

# Define your own new metrics
myMetrics = function(z, i)
{
  metrics = list(
     imean = mean(i),
     imax  = max(i),
     npoint = length(z)
   )

   return(metrics)
}

metrics = tree_metrics(las, myMetrics(Z, Intensity))

# predefined metrics (see ?stdmetrics)
metrics = tree_metrics(las, .stdtreemetrics)
# }
Documentation reproduced from package lidR, version 1.3.0, License: GPL-3

Community examples

Looks like there are no examples yet.