Learn R Programming

lidR (version 4.1.0)

filters: Filter points of interest

Description

Filter points of interest (POI) from a LAS object where conditions are true.

Usage

filter_poi(las, ...)

filter_first(las)

filter_firstlast(las)

filter_firstofmany(las)

filter_ground(las)

filter_last(las)

filter_nth(las, n)

filter_single(las)

filter_duplicates(las)

# S3 method for LAS filter_duplicates(las)

# S3 method for LAScatalog filter_duplicates(las)

Value

An object of class LAS

Arguments

las

An object of class LAS

...

Logical predicates. Multiple conditions are combined with '&' or ','

n

integer ReturnNumber == n

Non-supported LAScatalog options

The option select is not supported and not respected because it always preserves the file format and all the attributes. select = "*" is imposed internally.

Details

  • filter_poi Select points of interest based on custom logical criteria.

  • filter_first Select only the first returns.

  • filter_firstlast Select only the first and last returns.

  • filter_ground Select only the returns classified as ground according to LAS specification.

  • filter_last Select only the last returns i.e. the last returns and the single returns.

  • filter_nth Select the returns from their position in the return sequence.

  • filter_firstofmany Select only the first returns from pulses which returned multiple points.

  • filter_single Select only the returns that return only one point.

  • filter_duplicates Removes the duplicated points (duplicated by XYZ)

Examples

Run this code
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar = readLAS(LASfile)

# Select the first returns classified as ground
firstground = filter_poi(lidar, Classification == 2L & ReturnNumber == 1L)

# Multiple arguments are equivalent to &
firstground = filter_poi(lidar, Classification == 2L, ReturnNumber == 1L)

# Multiple criteria
first_or_ground = filter_poi(lidar, Classification == 2L | ReturnNumber == 1L)

Run the code above in your browser using DataLab