Skip to content

uw-cryo/lidar_tools

Repository files navigation

lidar_tools

Actions Status DOI

Tools to process airborne and satellite LiDAR point clouds.

Warning! This package is under active development and may change rapidly!

Datasets Supported

Output Products

  • Digital Surface Models: IDW interpolation based gridding of height values for first and only returns.
  • Digital Terrain Models: IDW interpolation based gridding of height values for ground returns (Classification==2). We do not perform ground classification ourselves, input point clouds need to have ground returns labelled for terrain models generation. An additional gap-filled product using IDW interpolation with a 9 x 9 kernel can also be produced which is useful in reducing data gaps in areas with dense canopy or buildings.
  • Surface Intensity: IDW interpolation based gridding of surface intensity values for first and only returns.

UW Campus preview Sample of standard products created with lidar_tools rasterize utility for University of Washington Campus AOI, using publicly-available USGS 3DEP lidar point clouds (WA_KingCounty_2021_B21)

Quickstart

lidar_tools is a collection of CLI scripts to process LiDAR data. It should be installed into a stand-alone environment to ensure that scripts execute as intended. We recommend using pixi to install a locked software environment.

We recommend using pixi package manager to install a locked software environment for executing code in this repository.

Pixi can be installed following instructions from here. For Linux and Mac OSX machines, pixi can be installed from the terminal by running the below command:

curl -fsSL https://pixi.sh/install.sh | sh
git clone https://github.com/uw-cryo/lidar_tools.git
cd lidar_tools
pixi install --frozen

Example workflow

Run our example workflow to create DSM, DTM without interpolation, DTM with interpolation, and LiDAR Intensity for 3DEP data over a part of University of Washington Campus in Seattle, WA!

# NOTE: takes ~5 min to run
pixi run example

CLI Commands:

Once installed, you can run processing scripts from a terminal:

export PIXI_FROZEN=true # NOTE: set this to always use locked environment
pixi shell # NOTE: 'exit' deactivates the environment
lidar-tools rasterize --help
Usage: lidar-tools rasterize [ARGS] [OPTIONS]

Create a Digital Surface Model (DSM), Digital Terrain Model (DTM) and/or Intensity raster from point cloud data.

╭─ Parameters ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  GEOMETRY --geometry                            Path to the vector dataset containing a single polygon that defines the processing extent. [required]          │
│    INPUT --input                                  Path to directory containing input LAS/LAZ files, otherwise uses USGS 3DEP EPT data on AWS. [default: EPT_AWS] │
│    OUTPUT --output                                Path to output directory. [default: /tmp/lidar-tools-output]                                                   │
│    SRC-CRS --src-crs                              Path to file with PROJ-supported CRS definition to override CRS of input files.                                │
│    DST-CRS --dst-crs                              Path to file with PROJ-supported CRS definition for the output. If unspecified, a local UTM CRS will be used.  │
│    RESOLUTION --resolution                        Square output raster posting in units of dst_crs. [default: 1.0]                                               │
│    PRODUCTS --products                            Which output products to generate: all products, digital surface model, digital terrain model, or intensity    │
│                                                   raster. [choices: all, dsm, dtm, intensity] [default: all]                                                     │
│    THREEDEP-PROJECT --threedep-project            "all" processes all available 3DEP EPT point clouds which intersect with the input polygon. "first" 3DEP       │
│                                                   project encountered will be processed. "specific" should be a string that matches the "project" name in the    │
│                                                   3DEP metadata. [choices: all, latest] [default: latest]                                                        │
│    TILE-SIZE --tile-size                          The size of rasterized tiles processed from input EPT point clouds in units of dst_crs. [default: 1.0]         │
│    NUM-PROCESS --num-process                      [default: 1]                                                                                                   │
│    OVERWRITE --overwrite                          Overwrite output files if they already exist. [default: False]                                                 │
│    CLEANUP --cleanup                              Remove the intermediate tif files, keep only final mosaiced rasters. [default: False]                          │
│    PROJ-PIPELINE --proj-pipeline                  A PROJ pipeline string to be used for reprojection of the point cloud. If specified, this will be used in      │
│                                                   combination with the target_wkt option.                                                                        │
│    FILTER-NOISE --filter-noise --no-filter-noise  Remove noise points (classification==18 and classification==7) from the point cloud before DSM, DTM and        │
│                                                   surface intensity processing. Default is True. [default: True]                                                 │
│    HEIGHT-ABOVE-GROUND-THRESHOLD                  If specified, the height above ground (HAG) will be calculated using all nearest ground classied points, and   │
│      --height-above-ground-threshold              all points greater than this value will be classified as noise, by default None.                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Development

Use a developement environment (including pytest, ruff, mypy etc)

export PIXI_FROZEN=true # Disable this if you're changing dependency versions
pixi shell -e dev

Or run the test sweet

pixi run test

Run linting and formatting

pixi run lint
pixi run typecheck

Packaging

To create a conda package that can be installed into any conda environment:

pixi build

This will output a .conda file named something like lidar_tools-0.1.0-pyhbf21a9e_0.conda

To actually install the package it needs to put in a conda "registry" or "channel" like conda-forge. For now we are using a public channel at https://prefix.dev/channels for development:

conda install -c https://repo.prefix.dev/uw-cryo lidar_tools

About

Tools to process airborne and satellite LiDAR point clouds

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •