grid_terrain: Digital Terrain Model

Description Usage Arguments Value Working with a LAScatalog Supported processing options Examples

View source: R/grid_terrain.R

Description

Interpolates the ground points and creates a rasterized digital terrain model. The algorithm uses the points classified as "ground" and "water" (Classification = 2 and 9, respectively, according to LAS file format specifications) to compute the interpolation.

How well the edges of the dataset are interpolated depends on the interpolation method used. A buffer around the region of interest is always recommended to avoid edge effects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
grid_terrain(
  las,
  res = 1,
  algorithm,
  ...,
  keep_lowest = FALSE,
  full_raster = FALSE,
  use_class = c(2L, 9L),
  Wdegenerated = TRUE,
  is_concave = FALSE
)

Arguments

las

An object of class LAS or LAScatalog.

res

numeric. The resolution of the output Raster. Can optionally be a RasterLayer. In that case the RasterLayer is used as the layout.

algorithm

function. A function that implements an algorithm to compute spatial interpolation. lidR implements knnidw, tin, and kriging (see respective documentation and examples).

...

Unused

keep_lowest

logical. This option forces the original lowest ground point of each cell (if it exists) to be chosen instead of the interpolated values.

full_raster

logical. By default the interpolation is made only within the convex hull of the point cloud. This prevents meaningless interpolations where there is no data. If TRUE, each pixel of the raster is interpolated.

use_class

integer vector. By default the terrain is computed by using ground points (class 2) and water points (class 9).

Wdegenerated

logical. The function always checks and removes degenerated ground points for computing the DTM to avoid unexpected behaviours, such as infinite elevation. If TRUE, a warning is thrown to alert users to the presence of degenerated ground points.

is_concave

boolean. By default the function tries to compute a DTM that has the same shape as the point cloud by interpolating only in the convex hull of the points. If the point cloud is concave this may lead to weird values where there are no points. Use is_concave = TRUE to use a concave hull. This is more computationally -involved and requires the concaveman package.

Value

A RasterLayer containing a numeric value in each cell. If the RasterLayers are written on disk when running the function with a LAScatalog, a virtual raster mosaic is returned (see gdalbuildvrt)

Working with a LAScatalog

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 grid_* functions (in bold). For more details see the LAScatalog engine documentation:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
LASfile <- system.file("extdata", "Topography.laz", package="lidR")
las = readLAS(LASfile, filter = "-inside 273450 5274350 273550 5274450")
#plot(las)

dtm1 = grid_terrain(las, algorithm = knnidw(k = 6L, p = 2))
dtm2 = grid_terrain(las, algorithm = tin())

## Not run: 
dtm3 = grid_terrain(las, algorithm = kriging(k = 10L))

plot(dtm1)
plot(dtm2)
plot(dtm3)
plot_dtm3d(dtm1)
plot_dtm3d(dtm2)
plot_dtm3d(dtm3)

## End(Not run)

lidR documentation built on June 21, 2021, 5:07 p.m.