Learn R Programming

lidR (version 1.2.0)

grid_terrain: Digital Terrain Model

Description

Interpolate ground points and create a rasterized digital terrain model. The interpolation can be done using 3 methods: "knnidw", "delaunay" or "kriging" (see details). The algorithm uses the points classified as "ground" to compute the interpolation.

Usage

grid_terrain(.las, res = 1, method, k = 10L, model = gstat::vgm(0.59,
  "Sph", 874), keep_lowest = FALSE)

Arguments

.las

LAS objet

res

numeric resolution.

method

character can be "knnidw", "delaunay" or "kriging" (see details)

k

numeric. number of k-nearest neighbours when the selected method is either "knnidw" or "kriging"

model

a variogram model computed with vgm when the selected method is "kriging". If null it performs an ordinary or weighted least squares prediction.

keep_lowest

logical. The function forces the original lowest ground point of each pixel (if it exists) to be chosen instead of the interpolated values.

Value

A lasmetrics data.table.

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 using the interp function from package akima. This method is very fast. It makes a linear interpolation within each triangle. Note that with this method no extrapolation is done outside of the convex hull determined by the ground points.

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

grid_terrain lasnormalize vgm krige interp lasnormalize RasterLayer

Examples

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

dtm1 = grid_terrain(lidar, method = "knnidw", k = 6)
dtm2 = grid_terrain(lidar, method = "delaunay")
dtm3 = grid_terrain(lidar, method = "kriging", k = 10)

# }
# NOT RUN {
plot(dtm1)
plot(dtm2)
plot(dtm3)
plot3d(dtm1)
plot3d(dtm2)
plot3d(dtm3)
# }

Run the code above in your browser using DataLab