Learn R Programming

lidR (version 1.4.2)

grid_canopy: Canopy surface model

Description

Creates a canopy surface model using a LiDAR point cloud. For each pixel the function returns the highest point found (point-to-raster). This basic method could be improved by replacing each LiDAR return with a small disk. An interpolation for empty pixels is also available.

Usage

grid_canopy(x, res = 2, subcircle = 0, na.fill = "none", ...,
  filter = "")

Arguments

x

An object of class LAS or a catalog (see section "Use with a LAScatalog")

res

numeric. The size of a grid cell in LiDAR data coordinates units. Default is 2 meters i.e. 4 square meters.

subcircle

numeric. radius of the circles. To obtain fewer empty pixels the algorithm can replace each return with a circle composed of 8 points (see details).

na.fill

character. name of the algorithm used to interpolate the data and fill the empty pixels. Can be "knnidw", "delaunay" or "kriging" (see details).

...

extra parameters for the algorithm used to interpolate the empty pixels (see details)

filter

character. Streaming filter while reading the files (see readLAS). If x is a LAScatalog the function readLAS is called internally. The user cannot manipulate the lidar data directly but can use streaming filters instead.

Value

Returns a data.table of class lasmetrics, which enables easier plotting and RasterLayer casting.

Use with a <code>LAScatalog</code>

When the parameter x is a LAScatalog the function processes the entire dataset in a continuous way using a multicore process. Parallel computing is set by default to the number of core available in the computer. The user can modify the global options using the function catalog_options. lidR support .lax file. Computation speed will be significantly improved with a spatial index.

Details

The algorithm relies on a point-to-raster approach. For each pixel the elevation of the highest point is found and attributed to this pixel. This method implies that the resulting surface model can contain empty pixels. Those 'holes' can be filled by interpolation. Internally, the interpolation is based on the same method used in the function grid_terrain. Therefore the documentation for grid_terrain is also applicable to this function (see also examples). The 'subcircle' tweak replaces each point with 8 points around the original one. This allows for virtual 'emulation' of the fact that a lidar point is not a point as such, but more realistically a disc. This tweak densifies the point cloud and the resulting canopy model is smoother and contains fewer 'pits' and empty pixels.

See Also

grid_metrics as.raster

Examples

Run this code
# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)

# Local maximum algorithm with a resolution of 2 meters
lidar %>% grid_canopy(2) %>% plot

# Local maximum algorithm with a resolution of 1 meter replacing each
# point by a 20 cm radius circle of 8 points
lidar %>% grid_canopy(1, 0.2) %>% plot

# Local maximum algorithm with a resolution of 1 meter replacing each
# point by a 10 cm radius circle of 8 points and interpolating the empty
# pixels using the 3-nearest neighbours and an inverse-distance weighting.
grid_canopy (lidar, 1, subcircle = 0.1, na.fill = "knnidw", k = 3, p = 2) %>% plot

# }
# NOT RUN {
grid_canopy(lidar, 1, na.fill = "knnidw", k = 3) %>% plot
grid_canopy(lidar, 1, subcircle = 0.1, na.fill = "delaunay") %>% plot
# }

Run the code above in your browser using DataLab