# 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