classify_ground: Classify points as 'ground'

Description Usage Arguments Value Working with a LAScatalog Supported processing options Examples

View source: R/classify_ground.R

Description

Classify points as 'ground' with several possible algorithms. The function updates the attribute Classification of the LAS object. The points classified as 'ground' are assigned a value of 2 according to las specifications.

Usage

1
classify_ground(las, algorithm, last_returns = TRUE)

Arguments

las

An object of class LAS or LAScatalog.

algorithm

a ground-segmentation function. lidR has: pmf and csf. The lidRplugins package has 'mcc'.

last_returns

logical. The algorithm will use only the last returns (including the first returns in cases of a single return) to run the algorithm. If FALSE all the returns are used. If the attribute 'ReturnNumber' or 'NumberOfReturns' are absent, 'last_returns' is turned to FALSE automatically.

Value

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

Working with a LAScatalog

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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
LASfile <- system.file("extdata", "Topography.laz", package="lidR")
las <- readLAS(LASfile, select = "xyzrn", filter = "-inside 273450 5274350 273550 5274450")

# Using the Progressive Morphological Filter
# --------------------------------------

# (Parameters chosen mainly for speed)
ws  <- seq(3,12, 4)
th  <- seq(0.1, 1.5, length.out = length(ws))

las <- classify_ground(las, pmf(ws, th))
#plot(las, color = "Classification")

#' # Using the Cloth Simulation Filter
# --------------------------------------

# (Parameters chosen mainly for speed)
mycsf <- csf(TRUE, 1, 1, time_step = 1)
las <- classify_ground(las, mycsf)
#plot(las, color = "Classification")

Example output

Loading required package: raster
Loading required package: sp
Warning message:
In showSRID(SRS_string, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
  Discarded datum NAD83 Canadian Spatial Reference System in CRS definition
Original dataset already contains 1981 ground points. These points were reclassified as 'unclassified' before performing a new ground classification.

lidR documentation built on June 21, 2021, 5:07 p.m.