lidR (version 2.0.3)

tree_hulls: Compute the hull of each tree.

Description

Compute the hull of each segmented tree. The hull can be convex, concave or a bounding box (see details and references).

Usage

tree_hulls(las, type = c("convex", "concave", "bbox"), concavity = 3,
  length_threshold = 0, attribute = "treeID")

Arguments

las

An object of class LAS or LAScatalog.

type

character. Hull type. Can be 'convex', 'concave' or 'bbox'.

concavity

numeric. If type = "concave", a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull.

length_threshold

numeric. If type = "concave", when a segment length is below this threshold, no further detail is added. Higher values result in simpler shapes.

attribute

character. The attribute where the ID of each tree is stored. In lidR, the default is "treeID".

Value

A SpatialPolygonsDataFrame. If a tree has less than 4 points it is not considered.

Working with a <code>LAScatalog</code>

This section appears in each function that supports a LAScatalog as input.

In lidR when the input of a function is a LAScatalog the function uses the LAScatalog processing engine. The user can modify the engine options using the available options. A careful reading of the engine documentation is recommended before processing LAScatalogs. Each lidR function should come with a section that documents the supported engine options.

The LAScatalog engine supports .lax files that significantly improve the computation speed of spatial queries using a spatial index. Users should really take advantage a .lax files, but this is not mandatory.

Supported processing options

Supported processing options for a LAScatalog (in bold). For more details see the LAScatalog engine documentation:

  • chunk size: How much data is loaded at once.

  • chunk buffer*: Mandatory to get a continuous output without edge effects. The buffer is always removed once processed and will never be returned either in R or in files.

  • chunk alignment: Align the processed chunks.

  • cores: How many cores are used.

  • progress: Displays a progression estimation.

  • output_files: Supported templates are {XLEFT}, {XRIGHT}, {YBOTTOM}, {YTOP}, {XCENTER}, {YCENTER} {ID} and, if chunk size is equal to 0 (processing by file), {ORIGINALFILENAME}.

  • laz_compression: write las or laz files

  • select: The function will write files equivalent to the original ones. Thus select = "*" and cannot be changed.

  • filter: Read only points of interest.

Details

The concave hull method under the hood is described in Park & Oh (2012). The function relies on the concaveman function which itself is a wrapper around Vladimir Agafonking's implementation.

References

Park, J. S., & Oh, S. J. (2012). A new concave hull algorithm and concaveness measure for n-dimensional datasets. Journal of Information science and engineering, 28(3), 587-600.

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las = readLAS(LASfile, select = "xyz0", filter = "-drop_z_below 0")

# Note: the trees are already segmented in this file and the IDs
# are stored in extrabytes 0.

convex_hulls = tree_hulls(las)
sp::plot(convex_hulls)

bbox_hulls = tree_hulls(las, "bbox")
sp::plot(bbox_hulls)

# }
# NOT RUN {
concave_hulls = tree_hulls(las, "concave")
sp::plot(concave_hulls)
# }

Run the code above in your browser using DataCamp Workspace