Fast Airborne LiDAR Data Processing
The lasr library (pronounced “laser”) is a C++ library for large scale airborne point cloud processing with C++, R an Python APIs. It enables the creation and execution of complex processing pipelines on massive lidar data. It can read and write .las, .laz and .pcd files, compute metrics using an area-based approach, generate digital canopy models, segment individual trees, decimate point data, and process collections of files using multicore processing strategies.
lasr offers a range of tools to process massive volumes of lidar data efficiently in a production environment using either the C++ API, the R API (lasR package) or the Python API (pylasr package).
💵 Sponsor lasr. It is free and open source, but requires time and effort to develop and maintain.
Documentation
- 📖 Start with the tutorial to learn how to use
lasRin R. - 🐍 For Python users, see the Python documentation and examples.
The most comprehensive source of documentation is the R package lasR documentation,
as lasr is primarily an R package. Even Python users should start with the R tutorial, while the examples are written in R, the tutorial is more about the general concepts than about coding.
APIs
R API
There is no current plan to release lasR on CRAN. Instead, it is hosted on r-universe:
install.packages('lasR', repos = 'https://r-lidar.r-universe.dev')Since lasR is not available on CRAN, users cannot rely on the CRAN versioning system or the RStudio update button to get the latest version. Instead, when lasR is loaded with library(lasR), an internal routine checks for the latest version and notifies the user if an update is available. This approach allows for more frequent updates, ensuring users have access to the newest features and bug fixes without waiting for a formal release cycle.
Python API
pylasr is the Python API for lasr, providing a clean, Pythonic interface to the high-performance C++ library for processing large-scale LiDAR point clouds.
Prerequisites
- Python 3.9+
- C++17 compatible compiler
- GDAL (>= 2.2.3), GEOS (>= 3.4.0), PROJ (>= 4.9.3)
Build from source
Pre-built packages will be available on PyPI in the future. For now, please build from source.
C++ API
To use lasr in a C++ program, it must be linked to gdal and proj. Other dependencies are provided in the vendor directory. Tools available to the public are given in api.h.
Examples
Below is a simple example of a pipeline that classifies and removed outliers before to produce a Digital Surface Model and a Digital Terrain Model from a folder containing airborne LiDAR point clouds. For more examples see the tutorial.
R
library(lasR)
folder = "/folder/of/laz/tiles/"
pipeline = classify_with_sor() + delete_noise() + chm(1) + dtm(1)
exec(pipeline, on = folder, ncores = 16, progress = TRUE)C++
The C++ API is significantly more complex to use. The R and Python APIs aim to provide high-level interfaces in high-level languages, making usages simpler and more user-friendly. The low-level C++ API was never intended for standalone use; instead, it serves as a bridge for building other high-level APIs.
#include "api.h"
using namespace api;
std::string on = "/folder/of/laz/tiles/"
// platform independent tmp files
std::filesystem::path temp_dir = std::filesystem::temp_directory_path();
std::filesystem::path temp_dsm = temp_dir / "dsm.tif";
std::filesystem::path temp_dtm = temp_dir / "dtm.tif";
Pipeline tri = triangulate(0, {"Classification %in% 2 9"});
Pipeline dtm = rasterize_triangulation(tri.get_stages().front().get_uid(), 1, temp_dtm.string());
Pipeline p;
p += classify_with_sor();
p += delete_points({"Classification == 18"});
p += rasterize(1, 1, {"max"}, {""}, temp_dsm.string());
p += tri;
p += dtm;
p.set_files(on);
p.set_concurrent_files_strategy(8);
p.set_progress(false);
std::string file = p.write_json();
return execute(file);Main Differences with lidR
The following benchmark compares the time and RAM usage of lasR (R API) and lidR for producing a Digital Terrain Model (DTM), a Canopy Height Model (CHM), and a raster containing two metrics derived from elevation (Z) and intensity. The test was conducted on 120 million points stored in 4 LAZ files. For more details, check out the benchmark vignette.

-
Pipelines:
lasRintroduces pipelines to optimally chain multiple operations on a point cloud, a feature not available inlidR. -
Algorithm Efficiency:
lasRuses more powerful algorithms designed for speed and efficiency. -
Language and Performance: Entirely written in C/C++,
lasRhas no R code except for the API interface. This makes it highly optimized for performance. -
Memory Usage: Unlike
lidR, which loads the point cloud into an Rdata.frame,lasRstores point clouds in a C++ structure that is not exposed to the user, minimizing memory usage. -
Dependencies:
lasRhas a single strong dependency ongdal. Ifsfandterraare installed, the user experience is enhanced, but they are not mandatory.
For more details, see the relevant vignette.
Copyright Information
lasr is free and open source and relies on other free and open source tools.
- For
lasr:- © 2023-2025 Jean-Romain Roussel
- Licence: GPL-3
- For
lasR(R bindings):- © 2023-2025 Jean-Romain Roussel
- Licence: GPL-3
- For
pylasr(Python bindings):- © 2025 Alexey Grigoryev
- Licence: GPL-3
- For
LASlibandLASzip:- © 2007-2021 Martin Isenburg - http://rapidlasso.com
- Licence: LGPL (modified to be R-compliant by Jean-Romain Roussel)
- See the dedicated readme for more details about the modifications made and alternative linking.
- For
chm_prep:- © 2008-2023 Benoît St-Onge - Geophoton-inc/chm_prep
- Licence: GPL-3
- For
jsonparser:- Lohmann, N. (2023). JSON for Modern C++ (Version 3.11.3) [Computer software]. https://github.com/nlohmann
- Licence: MIT
- For
delaunator:- © 2018 Volodymyr Bilonenko. delfrrr/delaunator-cpp
- Licence: MIT
- For
Eigen:- Guennebaud, Gaël and Jacob, Benoît and others
- Eigen: A C++ linear algebra library http://eigen.tuxfamily.org
- Licence: MPL2
- For
Cloth Simulation Filter (CSF)- © 2017 State Key Laboratory of Remote Sensing Science, Institute of Remote Sensing Science and Engineering, Beijing Normal University
- Licence: Apache
- W. Zhang, J. Qi, P. Wan, H. Wang, D. Xie, X. Wang, and G. Yan, “An Easy-to-Use Airborne LiDAR Data Filtering Method Based on Cloth Simulation,” Remote Sens., vol. 8, no. 6, p. 501, 2016.
About
lasr is developed openly by r-lidar.
The initial development of lasr was made possible through the financial support of Laval University. To continue the development of this free software, we now offer consulting, programming, and training services. For more information, please visit our website.
