Learn R Programming

lidR (version 1.2.1)

lasnormalize: Subtract digital terrain model

Description

Subtract digital terrain model (DTM) from LiDAR data to create a dataset normalized with the ground at 0. The DTM can originate from several sources e.g. from an external file or computed by the user. It can also be computed on the fly. In this case the algorithm does not use rasterized data and each point is interpolated. There is no inacuracy due to the discretization of the terrain (but it is slower).

Usage

lasnormalize(.las, dtm = NULL, method = "none", k = 10L,
  model = gstat::vgm(0.59, "Sph", 874))

Arguments

.las

a LAS object

dtm

a RasterLayer or a lasmetrics object computed with grid_terrain.

method

character. Used if dtm = NULL. Can be "knnidw", "delaunay" or "kriging" (see grid_terrain for more details)

k

numeric. Used if dtm = NULL. Number of k-nearest neighbours when the selected method is either "knnidw" or "kriging"

model

Used if dtm = NULL. A variogram model computed with vgm when the selected method is "kriging". If NULL it performs an ordinary or weighted least squares prediction.

Value

A LAS object

See Also

raster grid_terrain

Examples

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

plot(las)

# --- First option: compute a raster DTM with grid_terrain ---
# (or read it from a file)

dtm = grid_terrain(las, method = "kriging", k = 10L)
nlas = lasnormalize(las, dtm)
plot(dtm)
plot(nlas)

# --- Second option: interpolate each point (no discretization) ---

nlas = lasnormalize(las, method = "kriging", k = 10L, model = gstat::vgm(0.59, "Sph", 874))
plot(nlas)
# }

Run the code above in your browser using DataLab