Tree-Level Variables Estimation for Several Plots
tree.detection.several.plots.Rd
This function integrates both, the normalize
and tree.detection.single.scan
or tree.detection.multi.scan
functions, generating the same ‘Output Files’ as indicated for these, and it returs the same ‘Value’ as described for tree.detection.single.scan
or tree.detection.multi.scan
respectively. However, this function is designed for working with several plots, producing a list of all scans considered automatically from LAS files.
Usage
tree.detection.several.plots(las.list, id = NULL, file = NULL,
scan.approach = "single",
pcd.red = NULL, normalized = NULL,
x.center = NULL, y.center = NULL,
max.dist = NULL, min.height = NULL, max.height = 50,
algorithm.dtm = "knnidw", res.dtm = 0.2,
csf = list(cloth_resolution = 0.5),
RGB = NULL,
dbh.min = 4, dbh.max = 200, h.min = 1.3,
ncr.threshold = 0.1,
tls.resolution = NULL, tls.precision = NULL,
stem.section = NULL, breaks = NULL,
den.type = 1, d.top = NULL,
plot.attributes = NULL,
dir.data = NULL, save.result = TRUE, dir.result = NULL)
Arguments
- las.list
Character vector containing the names of all LAS files for analysis and belonging to TLS point cloud, including .las extension (see ‘Examples’)
- id
Optional vector with plots identification encoded as character string or numeric. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, the plots will be encoded with correlative numbers from 1 to n plots.
- file
Optional vector containing files name identification encoded as character string or numeric value. If it is null, file will be encoded as
id
by default.- scan.approach
Character parameter indicating TLS single-scan (‘single’) or TLS multi-scan approach or SLAM point clouds (‘multi’) approaches. If this argument is not specified by the user, it will be set to ‘multi’ approach.
- pcd.red
Optional argument to indicate if point cloud density must be reduced to detect trees.
- normalized
Optional argument to establish as
TRUE
when point cloud is already normalized.- x.center
Planimetric x center coordinate of point cloud data.
- y.center
Planimetric y center coordinate of point cloud data.
- max.dist
Optional maximum horizontal distance (m) considered from the plot centre. All points farther than
max.dist
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmax.dist
representing the farthest point.- min.height
Optional minimum height (m) considered from ground level. All points below
min.height
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmin.height
representing the lowest point.- max.height
Optional maximum height (m) considered from ground level. All points above
max.height
will be discarded after the normalization process. If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, all points will be used in processing, withmax.height
representing the highest point.- algorithm.dtm
Algorithm used to generate the digital terrain model (DTM) from the TLS point cloud. There are two posible options based on spatial interpolation: ‘tin’ and ‘knnidw’ (see ‘Details’). If this argument is not specified by the user, it will be set to ‘knnidw’ algorithm.
- res.dtm
Numeric parameter. Resolution of the DTM generated to normalize point cloud (see ‘Details’). If this argument is not specified by the user, it will be set to 0.2 m.
- csf
List containing parameters of CSF algorithm:
cloth_resolution
: by default 0.5.
- RGB
Logical parameter useful when point clouds are colorized, thus including values of RGB colors. It is based on the Green Leaf Algorithm (GLA) (see ‘Details’).
- dbh.min
Optional minimum dbh (cm) considered for detecting trees. By default it will be set at 4 cm.
- dbh.max
Optional maximum dbh (cm) considered for detecting trees. By default it will be set at 200 cm.
- h.min
Optional minimum h (m) considered for detecting trees. By default it will be set at 1.3 m.
- ncr.threshold
Local surface variation (also known as normal change rate, NCR). By default it will be set as 0.1. For better understanding of this argument see ‘Details’.
- tls.resolution
List containing parameters of TLS resolution. This can be defined by the angle aperture:
horizontal.angle
: horizontal angle aperture (degrees).vertical.angle
: vertical angle aperture (degrees).point.dist
: distance (mm) between two consecutive points.tls.dist
: distance (m) from TLS at which two consecutive points are separated bypoint.dist
.If this argument is not specified by the user, it will be set to NULL by default and, as a consequence the function will stop giving an error message.
- tls.precision
Optional argument indicating the average point cloud precision in cm.
- breaks
Height above ground level (m) of slices considered for detecting trees. By default it will be considered all possible sections from 0.1 m to maximum height by 0.3 m intervals (+/- 5 cm).
- stem.section
Section free of noise (shurb, branches, etc.) considered to detect trees. If not specified, an automatic internal algorithm will be applied (see ‘Details’).
- d.top
Top stem diameter (cm) considered to estimate commercial timber volume.
- den.type
Numeric argument indicating the dendrometic type used to estimate volumen when there are not sections enough to fit a taper equation. Dendrometrics types available are the following: cylinder = 0, paraboloid = 1 (by default), cone = 2 and neiloid = 3.
- plot.attributes
Data frame with attributes at plot level. It must contain a column named
id
(character string or numeric value) with encoding coinciding with that used inid
argument ofnormalize
for identifying plots. If there are strata, another column named ‘stratum’ (numeric) will be required for other functionalities of FORTLS (see, for instance,estimation.plot.size
ormetrics.variables
). If this argument is not specified by the user, it will be set to NULL by default and, as a consequence, the function will not add these possible plot attributes.- dir.data
Optional character string naming the absolute path of the directory where LAS files containing TLS point clouds are located.
.Platform$file.sep
must be used as the path separator indir.dat
. If this argument is not specified by the user, it will be set toNULL
by default and, as consequence, the current working directory of the R process will be assigned todir.dat
during the execution.- save.result
Optional logical which indicates whether or not the output files described in ‘Output Files’ section should be saved in the
dir.result
. If this argument is not specified by the user, it will be set toTRUE
by default and, as a consequence, the output files will be saved.- dir.result
Optional character string naming the absolute path of an existing directory where files described in ‘Output Files’ section will be saved.
.Platform$file.sep
must be used as the path separator indir.result
. If this argument is not specified by the user, andsave.result
isTRUE
, it will be set toNULL
by default and, as a consequence, the current working directory of the R process will be assigned todir.result
during the execution.
Details
See normalize
, tree.detection.single.scan
and tree.detection.multi.scan
for further details.
Value
Data frame with the same description and format as tree.detection.single.scan
and tree.detection.multi.scan
‘Values’. In this case, the id
of plots will be encoded with correlative numbers from 1 to n, where n is the number of LAS files included in files
argument, and file
column will be encoded as id
, but including .las extension.
Output Files
At the end of the tree detection process, if the save.result
argument is TRUE
, the function will save both, the reduced point clouds as TXT files encoded according to file
column of ‘Value’; and the data frame with the tree list described in ‘Value’ as CSV file (see normalize
and tree.detection.single.scan
or tree.detection.multi.scan
‘Output files’). All outputs are written without row names in the dir.result
directory using vroom_write
function from vroom package.
Note
This function has been developed for working with several plots, which will be the most common situation in forest inventory approaches. Nevertheless, several LAS files are not provided as examples due to problems with memory capacity.
Examples
# \donttest{
# Establishment of working directories (optional)
# By default here we propose the current working directory of the R process
dir.data <- getwd()
dir.result <- getwd()
# Loading example data (LAZ files) to dir.data
download.file("https://www.dropbox.com/s/j48chrbngwoma6y/Galicia_multi_scan.laz?dl=1",
destfile = file.path(dir.data, "Galicia_multi_scan.laz"),
mode = "wb")
download.file("https://www.dropbox.com/s/ypar7fwqcht8aw6/Go_Fagus_SLAM.laz?dl=1",
destfile = file.path(dir.data, "Go_Fagus_SLAM.laz"),
mode = "wb")
# Obtaining a vector with names of LAZ files located in dir.data
files <- list.files(pattern = "laz$", path = dir.data)
# Tree detection
tree.tls <- tree.detection.several.plots(las.list =
c("Galicia_multi_scan.laz",
"Go_Fagus_SLAM.laz"),
scan.approach = "multi",
breaks = 1.3, stem.section = c(1,5))
#> Computing plot: 1
#> Normalizing
#> Detecting trees
#> Error in dbscan_int(x, as.double(eps), as.integer(minPts), as.double(weights), as.integer(borderPoints), as.integer(search), as.integer(bucketSize), as.integer(splitRule), as.double(approx), frNN): std::bad_alloc
# }