⚠️There's a newer version (4.1.2) of this package.Take me there.

lidR

R package for Airborne LiDAR Data Manipulation and Visualization for Forestry Applications

The lidR package provides functions to read and write .las and .laz files, plot point clouds, compute metrics using an area-based approach, compute digital canopy models, thin LiDAR data, manage a collection of LAS/LAZ files, automatically extract ground inventories, process a collection of tiles using multicore processing, segment individual trees, classify points from geographic data, and provides other tools to manipulate LiDAR data in a research and development context.

:book: Read the book to get started with the lidR package. See changelogs on NEW.md

To cite the package use citation() from within R:

citation("lidR")
#> Roussel, J.R., Auty, D., Coops, N. C., Tompalski, P., Goodbody, T. R. H., Sánchez Meador, A., Bourdon, J.F., De Boissieu, F., Achim, A. (2021). lidR : An R package for analysis of Airborne Laser Scanning (ALS) data. Remote Sensing of Environment, 251 (August), 112061. <doi:10.1016/j.rse.2020.112061>.
#> Jean-Romain Roussel and David Auty (2023). Airborne LiDAR Data Manipulation and Visualization for Forestry Applications. R package version 3.1.0. https://cran.r-project.org/package=lidR

Key features

Read and display a las file

In R-fashion style the function plot, based on rgl, enables the user to display, rotate and zoom a point cloud. Because rgl has limited capabilities with respect to large datasets, we also made a package lidRviewer with better display capabilities.

las <- readLAS("<file.las>")
plot(las)

Compute a canopy height model

lidR has several algorithms from the literature to compute canopy height models either point-to-raster based or triangulation based. This allows testing and comparison of some methods that rely on a CHM, such as individual tree segmentation or the computation of a canopy roughness index.

las <- readLAS("<file.las>")

# Khosravipour et al. pitfree algorithm
thr <- c(0,2,5,10,15)
edg <- c(0, 1.5)
chm <- rasterize_canopy(las, 1, pitfree(thr, edg))

plot(chm)

Read and display a catalog of las files

lidR enables the user to manage, use and process a collection of las files. The function readLAScatalog builds a LAScatalog object from a folder. The function plot displays this collection on an interactive map using the mapview package (if installed).

ctg <- readLAScatalog("<folder/>")
plot(ctg, map = TRUE)

From a LAScatalog object the user can (for example) extract some regions of interest (ROI) with clip_roi(). Using a catalog for the extraction of the ROI guarantees fast and memory-efficient clipping. LAScatalog objects allow many other manipulations that can be done with multicore processing.

Individual tree segmentation

The segment_trees() function has several algorithms from the literature for individual tree segmentation, based either on the digital canopy model or on the point-cloud. Each algorithm has been coded from the source article to be as close as possible to what was written in the peer-reviewed papers. Our goal is to make published algorithms usable, testable and comparable.

las <- readLAS("<file.las>")

las <- segment_trees(las, li2012())
col <- random.colors(200)
plot(las, color = "treeID", colorPalette = col)

Wall-to-wall dataset processing

Most of the lidR functions can seamlessly process a set of tiles and return a continuous output. Users can create their own methods using the LAScatalog processing engine via the catalog_apply() function. Among other features the engine takes advantage of point indexation with lax files, takes care of processing tiles with a buffer and allows for processing big files that do not fit in memory.

# Load a LAScatalog instead of a LAS file
ctg <- readLAScatalog("<path/to/folder/>")

# Process it like a LAS file
chm <- rasterize_canopy(ctg, 2, p2r())
col <- random.colors(50)
plot(chm, col = col)

Full waveform

lidR can read full waveform data from LAS files and provides interpreter functions to convert the raw data into something easier to manage and display in R. The support of FWF is still in the early stages of development.

fwf <- readLAS("<fullwaveform.las>")

# Interpret the waveform into something easier to manage
las <- interpret_waveform(fwf)

# Display discrete points and waveforms
x <- plot(fwf, colorPalette = "red", bg = "white")
plot(las, color = "Amplitude", add = x)

About

lidR is developed openly at Laval University.

Install lidR dependencies on GNU/Linux

# Ubuntu
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libgdal-dev libgeos++-dev libudunits2-dev libproj-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libxt-dev libfftw3-dev

# Fedora
sudo dnf install gdal-devel geos-devel udunits2-devel proj-devel mesa-libGL-devel mesa-libGLU-devel freetype-devel libjpeg-turbo-devel

Copy Link

Version

Install

install.packages('lidR')

Monthly Downloads

4,408

Version

4.1.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Last Published

February 1st, 2024

Functions in lidR (4.1.0)

catalog_boundaries

Computes the polygon that encloses the points
classify

Classify points
deprecated

Deprecated functions in lidR
catalog_intersect

Subset a LAScatalog
clip

Clip points in regions of interest
decimate_points

Decimate a LAS object
catalog_retile

Retile a LAScatalog
dtm_idw

Spatial Interpolation Algorithm
dtm_kriging

Spatial Interpolation Algorithm
dsm_pitfree

Digital Surface Model Algorithm
dtm_tin

Spatial Interpolation Algorithm
itd_lmf

Individual Tree Detection Algorithm
interpret_waveform

Convert full waveform data into a regular point cloud
is

A set of boolean tests on objects
itd_manual

Individual Tree Detection Algorithm
gnd_mcc

Ground Segmentation Algorithm
gnd_csf

Ground Segmentation Algorithm
engine_options

Get or set LAScatalog processing engine options
dsm_point2raster

Digital Surface Model Algorithm
its_watershed

Individual Tree Segmentation Algorithm
its_silva2016

Individual Tree Segmentation Algorithm
dsm_tin

Digital Surface Model Algorithm
filters

Filter points of interest
engine

Functions for the LAScatalog processing engine not meant to be called directly by users
its_dalponte2016

Individual Tree Segmentation Algorithm
its_li2012

Individual Tree Segmentation Algorithm
lidR-spatial-index

Spatial index
merge_spatial

Merge a point cloud with a source of spatial data
noise_ivf

Noise Segmentation Algorithm
locate_trees

Individual tree detection
plugins

Plugin system
point_metrics

Point-based metrics
plot.lasmetrics3d

Plot voxelized LiDAR data
plot_3d

Add a spatial object to a point cloud scene
las_utilities

LAS utilities
lidR-LAScatalog-drivers

LAScatalog drivers
lidR-package

lidR: airborne LiDAR for forestry applications
old_spatial_packages

Older R Spatial Packages
lidR-parallelism

Parallel computation in lidR
nstdmetrics

Predefined non standard metrics
gnd_pmf

Ground Segmentation Algorithm
sample_maxima

Point Cloud Decimation Algorithm
sample_per_voxel

Point Cloud Decimation Algorithm
sample_random

Point Cloud Decimation Algorithm
segment

Segment a point cloud
las_check

Inspect a LAS object
pitfill_stonge2008

Pits and spikes filling
retrieve_pulses

Retrieve individual pulses, flightlines or scanlines
las_compression

Compression of the point cloud
noise_sor

Noise Segmentation Algorithm
readLASheader

Read a .las or .laz file header
st_bbox

Bounding box of a LAS* object
st_area

Surface covered by a LAS* object
plot

Plot a LAS* object
track_sensor_roussel2020

Sensor tracking algorithm
stdmetrics

Predefined standard metrics functions
readLAS

Read .las or .laz files
sample_homogenize

Point Cloud Decimation Algorithm
voxelize_points

Voxelize a point cloud
readLAScatalog

Create an object of class LAScatalog
range_correction

Intensity normalization algorithm
smooth_height

Smooth a point cloud
shape_detection

Algorithms for shape detection of the local point neighbourhood
normalize

Normalize point cloud
set_lidr_threads

Set or get number of threads that lidR should use
rasterize

Rasterize a point cloud
st_coordinates

Coordinates of a LAS* object in a matrix form
writeLAS

Write a .las or .laz file
snag_wing2015

Snags Segmentation Algorithm
track_sensor

Reconstruct the trajectory of the LiDAR sensor using multiple returns
st_hull

Concave and convex hulls for LAS objects
st_transform

Transform or convert coordinates of LAS objects
print.LAS

Tools inherited from base R for LAS* objects
st_crs

Get or set the projection of a LAS* object
track_sensor_gatziolis2019

Sensor tracking algorithm
aggregate

Metric derivation at different levels of regularization
LAS-class

An S4 class to represent a .las or .laz file
LAScatalog-class

An S4 class to represent a collection of .las or .laz files
LASheader

Create a LASheader object
LASheader-class

An S4 class to represent the header of .las or .laz files
Extract

Extract or Replace Parts of a LAS* Object
catalog_apply

LAScatalog processing engine
asprs

ASPRS LAS Classification
add_attribute

Add attributes into a LAS object
as

Transform to a list