lidR (version 1.0.2)

lasnormalize: Subtract digital terrain model

Description

Subtract digital terrain model (DTM) from the LiDAR data to create a dataset normalized with the ground at 0. The digital terrain model can originate from several sources e.g. from an external file or computed by the user. It can also be computed on the fly.

Usage

lasnormalize(.las, dtm = NULL, ...)

Arguments

.las

a LAS objet

dtm

a RasterLayer object from package raster. If NULL the function will automatically compute it on the fly using the function grid_terrain.

...

optional parameters for grid_terrain if dtm parameter is NULL.

Value

A LAS object.

See Also

raster grid_terrain

Examples

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

plot(lidar)

# --- First possibility: compute the DTM on the fly -----

lidar_norm = lasnormalize(lidar, method = "knnidw")

plot(lidar_norm)

# }
# NOT RUN {
# --- Second possibility: read the DTM from a file -----

dtm = raster::raster(terrain.tiff)

lidar_norm = lidar - dtm # is synonymous with lasnormalize(lidar, dtm)

plot(lidar_norm)
# }

Run the code above in your browser using DataLab