What LiDAR processing tools are available in Python?

laspy is another good LAS read/write software. It supports working with the data directly in numpy arrays and a number of other nice Pythonic features. It isn't processing software per se, however.

PDAL has the ability to use Python as an in-pipeline filtering language, but this isn't a processing engine either.

There isn't too much in the Python quiver for LiDAR and point cloud processing. I think some of this has to do with the volumes of data typically processed and the typical response to reach for C/C++ when faced with the challenge. I do hope that as Python improves (PyPy is driving lots of things, and it is the reason that I worked to have laspy developed) more Python point cloud processing software becomes available. I think the outlook is improving but things still aren't quite there yet.


I have recently released an open-source (MIT) stand-alone (i.e. no dependencies) library called WhiteboxTools for performing many types of geospatial analysis, including LiDAR data processing. The library is written in Rust and has extensive support for Python-based scripting. For example, the following Python script uses the WhiteboxTools library to populate the RGB colour data of LiDAR points in a LAS file:

from whitebox_tools import WhiteboxTools

wbt = WhiteboxTools()
wbt.work_dir = "/path/to/data/"
in_lidar = "lidar_data.las"
in_image = "airphoto.tif"
out_lidar = "colourized_lidar.las"
wbt.lidar_colourize(in_lidar, in_image, out_lidar) 

The LiDAR-specific processing tools of WhiteboxTools include the following functions:

  • BlockMaximum: Creates a block-maximum raster from an input LAS file.
  • BlockMinimum: Creates a block-minimum raster from an input LAS file.
  • FilterLidarScanAngles: Removes points in a LAS file with scan angles greater than a threshold.
  • FindFlightlineEdgePoints: Identifies points along a flightline's edge in a LAS file.
  • FlightlineOverlap: Reads a LiDAR (LAS) point file and outputs a raster containing the number of overlapping flight lines in each grid cell.
  • LidarElevationSlice: Outputs all of the points within a LiDAR (LAS) point file that lie between a specified elevation range.
  • LasToAscii: Converts one or more LAS files into ASCII text files.
  • LidarColourize: Adds the red-green-blue colour fields of a LiDAR (LAS) file based on an input image.
  • LidarGroundPointFilter: Identifies ground points within LiDAR dataset.
  • LidarIdwInterpolation: Interpolates LAS files using an inverse-distance weighted (IDW) scheme.
  • LidarHillshade: Calculates a hillshade value for points within a LAS file and stores these data in the RGB field.
  • LidarHistogram: Creates a histogram from LiDAR data.
  • LidarInfo: Prints information about a LiDAR (LAS) dataset, including header, point return frequency, and classification data and information about the variable length records (VLRs) and geokeys.
  • LidarJoin: Joins multiple LiDAR (LAS) files into a single LAS file.
  • LidarKappaIndex: Performs a kappa index of agreement (KIA) analysis on the classifications of two LAS files.
  • LidarNearestNeighbourGridding: Grids LAS files using nearest-neighbour scheme.
  • LidarPointDensity: Calculates the spatial pattern of point density for a LiDAR data set.
  • LidarPointStats: Creates several rasters summarizing the distribution of LAS point data.
  • LidarRemoveDuplicates: Removes duplicate points from a LiDAR data set.
  • LidarRemoveOutliers: Removes outliers (high and low points) in a LiDAR point cloud.
  • LidarSegmentation: Segments a LiDAR point cloud based on normal vectors.
  • LidarSegmentationBasedFilter: Identifies ground points within LiDAR point clouds using a segmentation based approach.
  • LidarTile: Tiles a LiDAR LAS file into multiple LAS files.
  • LidarTophatTransform: Performs a white top-hat transform on a Lidar dataset; as an estimate of height above ground, this is useful for modelling the vegetation canopy.
  • NormalVectors: Calculates normal vectors for points within a LAS file and stores these data (XYZ vector components) in the RGB field.

Additionally, there are numerous tools for processing the DEMs that are interpolated from LiDAR source data (e.g. feature-preserving denoising, hydro enforcement, etc). Details can be found in the User Manual. Source code can be found here, and the compiled binaries are on the Geomorphometry and Hydrogeomatics website, here.


Although not strictly a 'Python' library but rather a set of wrappers for other tools, in particular GRASS, there are the 'ARSF DEM Scripts' which I have written:

https://github.com/pmlrsg/arsf_dem_scripts

One of the aims was to provide a common set of Python functions for different command line tools (called using subprocess) with a method flag used to specify the tool.

Example usage to generate a DSM, intensity and density image is:

from arsf_dem import dem_lidar

# DSM image (GRASS, points2grid, SPDLib, FUSION or licensed LAStools)
dem_lidar.las_to_dsm('in_las.las', 'out_dsm.tif',
                      method='points2grid')

# Intensity image (GRASS or licensed version of LAStools)
dem_lidar.las_to_intensity('in_las.las', 'out_intensity.tif',
                           method='GRASS')

# Density image (GRASS only)
dem_lidar.grass_lidar.las_to_density('in_las.las', 'out_density.tif',
                                     bin_size=10)

There are quite a few LiDAR processing tools available through the GRASS Python wrapper which could also be used instead of / in addition to what is available through arsf_dem.