lidR (version 1.3.0)

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 inaccuracy due to the discretization of the terrain the resolution of the terrain is virtually infinite (but it is slower). Depending on the interpolation method, the edges of the dataset can be more or less poorly interpolated. A buffer around the region of interest is always recommended to avoid edge effects.

Usage

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

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.

copy

By default the point cloud is updated in place by reference. User can force the function to return a new point cloud. Set TRUE to get a compatibility with versions < 1.3.0

Value

The function returns NULL. The LAS object is updated by reference. Z is now the normalized elevation, A new column 'Zref' records the former elevations values. This is a way to save memory avoiding copies of the point cloud. But if copy = TRUE, a new LAS object is returned and the original one is not modified.

Details

knnidw

Interpolation is done using a k-nearest neighbour (KNN) approach with an inverse distance weighting (IDW). This is a fast but basic method for spatial data interpolation.

delaunay

Interpolation based on Delaunay triangulation. It makes a linear interpolation within each triangle. There are usually few points outside the convex hull, determined by the ground points at the very edge of the dataset which cannot be interpolated with a triangulation. Extrapolation is done using knnidw.

kriging

Interpolation is done by universal kriging using the krige function. This method combines the KNN approach with the kriging approach. For each point of interest it kriges the terrain using the k-nearest neighbour ground points. This method is more difficult to manipulate but it is also the most advanced method for interpolating spatial data.

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)
lasnormalize(las, dtm)

plot(dtm)
plot(las)

# --- Second option: interpolate each point (no discretization) ---
las = readLAS(LASfile)

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

Run the code above in your browser using DataCamp Workspace