Preprocessing with LAStools

Relevant Resources

Overview

Welcome to this pre-processing tutorial using LAStools. While lidR in R is a powerful tool for analyzing lidar data in a research and development context, it can be memory-intensive and slower when working with large point cloud collections.

LAStools is another suite of efficient, command-line-based tools for processing lidar data. In this initial tutorial, we will perform three preprocessing steps: tiling to break large files into manageable chunks, denoising to classify and remove erroneous points, and indexing to create spatial indexes that accelerate read times.

To follow along step by step with the LAStools preprocessing download the raw ALS data (95mb)

Result of running lasview -i data/fm_4km.laz

Result of running lasview -i data/fm_4km.laz
Note

LAStools requires installation outside of R (see rapidlasso.de/downloads)

After unzipping the folder, you will find a bin directory containing all the executable tools (e.g., lastile.exe, lasnoise.exe). To run the commands, you either need to navigate to this bin directory in your command prompt or add the directory to your system’s PATH environment variable.

You can follow along using the free version of LAStools, which is sufficient for these preprocessing steps. However, please note that some advanced features may require a paid license.

Download the pre-processed files to skip this step and move directly to the analysis in lidR.

Download LAZ files

For the following examples, we will assume the raw .laz file is in a folder C:\lidar_project\raw\ and you want to save the processed outputs to C:\lidar_project\processed\. Replace these paths with your own as needed.

Tiling with lastile

The first step in processing is often to tile the data.

A single lidar file (or a collection of large, irregularly shaped files) is difficult to process.

Tiling divides the data into a grid of smaller, square files. This is the foundation for efficient, parallel processing in lidR, LAStools, and other software.

Here we use the lastile tool for this. The command below takes all .laz files from our raw directory and creates 500x500 meter tiles.

Here we specify a buffer of 0 as lidR buffers tiles internally. Be sure to use a buffer when performing your entire workflow in LAStools to avoid artifacts at tile edges.

lastile -i "C:\lidar_project\raw\*.laz" ^
    -odir "C:\lidar_project\processed\tiled" ^ # output directory
    -olaz ^ # output format (compressed as .laz files)
    -tile_size 500 ^ # tile size in meters (unit of crs)
    -buffer 0  # buffer size 

Denoising lasnoise

Raw point cloud data can contain noise outlier points that are often above or below the main point cloud. These points can be caused by sensor errors, atmospheric interference, or returning energy from objects like birds. Noise can significantly skew analysis, so it’s important to remove it.

The lasnoise tool identifies these isolated points and classifies them. We will run this command on the tiled files we just created.

lasnoise "C:\lidar_project\processed\tiled\*.laz" ^
    -odir "C:\lidar_project\processed\denoise"
    -olaz

By default, lasnoise assigns noise points to classification code 7 (Low Point / Noise). It does not delete them.

This is good practice, as it allows you to inspect the classified noise before deciding to permanently remove the points using a filter command like las2las -i in.laz -o out.laz -drop_class 7

las2las -i "C:\lidar_project\processed\denoise\*.laz" ^
    -odir "C:\lidar_project\processed\clean"
    -drop_class 7

Indexing lasindex

Finally we can index our cleaned-up tiles. Indexing creates a small companion file (.lax) for each .laz file. This .lax file acts as a spatial index, allowing software like lidR to quickly find and read the file.

lasindex -i \tiled\*.laz 

This command will create a .lax file for each .laz file in the specified directory.

Now we will continue to the analysis in lidR using these pre-processed files!

To follow along with the rest of the tutorial download the pre-processed files to skip this step and move directly to the analysis in lidR.

Download the tiled, denoised, and indexed lidar files (95mb)

Download the tiled normalized files (95mb)