Skip to contents

Filters are strings used in the filter argument of lasR stages to process only the points of interest. Filters follow the format 'Attribute condition value(s)', e.g.: Z > 2, Intensity < 155, Classification == 2, or ReturnNumber == 1.
The available conditions include >, <, >=, <=, ==, !=, %in%, %out%, and %between%. The supported attributes are any names of the attributes of the point cloud such as X, Y, Z, Intensity, gpstime, UserData, ReturnNumber, ScanAngle, Amplitude and so on.
Note that filters never fail. If a filter references an attribute not present in the point cloud (e.g., Intensity < 50 in a point cloud without intensity data), the attribute is treated as if it has a value of 0. This behavior can impact conditions like Intensity < 50.
For convenience, the most commonly used filters have corresponding helper functions that return the appropriate filter string. Points that satisfy the specified condition are retained for processing, while others are ignored for the current stage.

Usage

keep_class(x)

drop_class(x)

keep_first()

drop_first()

keep_ground()

keep_ground_and_water()

drop_ground()

keep_noise()

drop_noise()

keep_z_above(x)

drop_z_above(x)

keep_z_below(x)

drop_z_below(x)

drop_duplicates()

# S3 method for class 'laslibfilter'
print(x, ...)

# S3 method for class 'laslibfilter'
e1 + e2

Arguments

x

numeric or integer as a function of the filter used.

...

Unused.

e1, e2

lasR objects.

Examples

f <- system.file("extdata", "Topography.las", package="lasR")
gnd = keep_class(c(2,9))
reader_las(gnd)
#>  -----------
#> reader (uid:5541)
#>   filter : Classification %in% 2 9 
#>   output :  
#> -----------
triangulate(filter = keep_ground())
#>  -----------
#> triangulate (uid:38ec)
#>   max_edge : 0 
#>   filter : Classification == 2 
#>   output :  
#>   use_attribute : Z 
#> -----------
rasterize(1, "max", filter = "Z > 5")
#>  -----------
#> rasterize (uid:6b06)
#>   res : 1 
#>   window : 1 
#>   method : max 
#>   filter : Z > 5 
#>   output : /tmp/RtmpUXX9w7/file1f161f3a8f28.tif 
#> -----------