Learn R Programming

FORTLS (version 1.0.6)

tree.detection.multiple: Tree Detection and Cross Section Estimation for Multiple Plots

Description

This function integrates both, the normalize and tree.detection functions, generating the same ‘Output Files’ as indicated for these, and it returs the same ‘Value’ as described for tree.detection. However, this function is designed for working with several plots, producing a list of all scans considered automatically from LAS files.

Usage

tree.detection.multiple(las.list, id = NULL, file = NULL,
                        normalize.arguments = list(max.dist = NULL,
                                                   min.height = NULL,
                                                   max.height = NULL,
                                                   algorithm.dtm = "tin",
                                                   res.dtm = 0.2),
                        tree.detection.arguments = list(dbh.min = 7.5,
                                                        dbh.max = 200,
                                                        ncr.threshold = 0.1,
                                                        tls.resolution = list(),
                                                        breaks = c(1.0, 1.3, 1.6),
                                                        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.

normalize.arguments

Optional list including the following arguments related to the normalization process (see normalize):

tree.detection.arguments

Optional list including the following arguments related to tree detection process (see tree.detection):

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 in dir.dat. If this argument is not specified by the user, it will be set to NULL by default and, as consequence, the current working directory of the R process will be assigned to dir.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 to TRUE 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 in dir.result. If this argument is not specified by the user, and save.result is TRUE, it will be set to NULL by default and, as a consequence, the current working directory of the R process will be assigned to dir.result during the execution.

Value

Data frame with the same description and format as tree.detection ‘Value’. 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 ‘Output files’). All outputs are written without row names in the dir.result directory using vroom_write function from vroom package.

Details

See normalize and tree.detection for further details.

See Also

normalize, tree.detection, distance.sampling, estimation.plot.size, simulations, metrics.variables.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
# 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 (LAS files) to dir.data

download.file("https://www.dropbox.com/s/2c3d320o3srcawb/1.las?raw=1",
              destfile = file.path(dir.data, "1.las"),
              mode = "wb")

download.file("https://www.dropbox.com/s/9k8zn5dt0xcxfof/2.las?raw=1",
              destfile = file.path(dir.data, "2.las"),
              mode = "wb")


# Obtaining a vector with names of LAS files located in dir.data

files <- list.files(pattern = "las$", path = dir.data)


# Tree detection

tree.list.tls <- tree.detection.multiple(las.list = files,
                                         normalize.arguments = list(max.dist = 15,
                                                                    min.height = 0.25,
                                                                    max.height = 25),
                                         tree.detection.arguments = list(dbh.min = 7.5,
                                                                         dbh.max = 50,
                                                                         breaks = 1.3,
                                         tls.resolution = list(point.dist = 7.67,
                                                               tls.dist = 10)),
                                         dir.data = dir.data, dir.result = dir.result)



# }

Run the code above in your browser using DataLab