Learn R Programming

lidR (version 2.0.0)

lasnormalize: Remove the topography from a point cloud

Description

Subtract digital terrain model (DTM) from LiDAR point cloud to create a dataset normalized with the ground at 0. The DTM can originate from an external file or can be 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 and the resolution of the terrain is virtually infinite. How well the edges of the dataset are interpolated depends on the interpolation method used. Thus, a buffer around the region of interest is always recommended to avoid edge effects. The attribute Z of the returned LAS object is the normalized elevation. A new attribute 'Zref' records the former elevation values, which enables the use of lasunormalize to restore original point elevations.

Usage

lasnormalize(las, algorithm)

lasunnormalize(las)

# S4 method for LAS,RasterLayer -(e1, e2)

# S4 method for LAS,`function` -(e1, e2)

Arguments

las

An object of class LAS or LAScatalog.

algorithm

a RasterLayer representing a digital terrain model (can be computed with grid_terrain) or a spatial interpolation function. lidR have tin, kriging, knnidw.

e1

a LAS object

e2

RasterLayer representing a digital terrain model (can be computed with grid_terrain) or a spatial interpolation function. lidR has tin, kriging, and knnidw.

Value

If the input is a LAS object, return a LAS object. If the input is a LAScatalog, returns a LAScatalog.

Working with a <code>LAScatalog</code>

This section appears in each function that supports a LAScatalog as input.

In lidR when the input of a function is a LAScatalog the function uses the LAScatalog processing engine. The user can modify the engine options using the available options. A careful reading of the engine documentation is recommended before processing LAScatalogs. Each lidR function should come with a section that documents the supported engine options.

The LAScatalog engine supports .lax files that significantly improve the computation speed of spatial queries using a spatial index. Users should really take advantage a .lax files, but this is not mandatory.

Supported processing options

Supported processing options for a LAScatalog (in bold). For more details see the LAScatalog engine documentation:

  • chunk size: How much data is loaded at once.

  • chunk buffer*: Mandatory to get a continuous output without edge effects. The buffer is always removed once processed and will never be returned either in R or in files.

  • chunk alignment: Align the processed chunks.

  • cores: How many cores are used. More cores means more data is loaded at once.

  • progress: Displays a progression estimation.

  • output_files*: Mandatory because the output is likely to be too big to be returned in R and needs to be written in las/laz files. Supported templates are {XLEFT}, {XRIGHT}, {YBOTTOM}, {YTOP}, {XCENTER}, {YCENTER} {ID} and, if chunk size is equal to 0 (processing by file), {ORIGINALFILENAME}.

  • laz_compression: write las or laz files

  • select: The function will write files equivalent to the original ones. Thus select = "*" and cannot be changed.

  • filter: Read only points of interest.

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: use a RasterLayer as DTM
# =======================================================

dtm <- grid_terrain(las, 1, kriging(k = 10L))
las <- lasnormalize(las, dtm)

plot(dtm)
plot(las)

# restore original elevations
las <- lasunnormalize(las)
plot(las)

# operator - can be used. This is equivalent to the previous
las <- las - dtm
plot(las)

# restore original elevations
las <- lasunnormalize(las)

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

las <- lasnormalize(las, tin())
plot(las)

# operator - can be used. This is equivalent to the previous
las <- lasunnormalize(las)
las <- las - tin()

# }
# NOT RUN {
# All the following syntaxes are correct
las <- lasnormalize(las, knnidw())
las <- lasnormalize(las, knnidw(k = 8, p = 2))
las <- las - knnidw()
las <- las - knnidw(k = 8)
las <- lasnormalize(las, kriging())
las <- las - kriging(k = 8)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab