Skip to main content

Python bindings for LASR library - Fast Airborne LiDAR Data Processing

Project description

LASR Python Bindings

Python bindings for the LASR (pronounced "laser") library - a high-performance LiDAR point cloud processing library.

Overview

The LASR Python bindings provide a clean, Pythonic interface to the powerful LASR C++ library for processing large-scale LiDAR point clouds. The API closely mirrors the R API, ensuring consistency across language bindings.

Features

  • High Performance: Direct bindings to optimized C++ code
  • Complete API Coverage: All LASR stages and operations available
  • Pythonic Interface: Natural Python syntax with operator overloading
  • Pipeline Processing: Chain operations for efficient processing
  • Multi-threading Support: Leverage multiple cores for processing
  • Memory Efficient: Minimal memory overhead through C++ backend
  • Rich Results: Access detailed stage outputs and processing statistics
  • Structured Error Handling: Comprehensive error information and debugging
  • Flexible Input Paths: Pass a directory/catalog or an iterable of path-like objects; only .las/.laz files are used

Installation

Prerequisites

  • Python 3.9+
  • pybind11
  • C++17 compatible compiler
  • GDAL (>= 2.2.3)
  • GEOS (>= 3.4.0)
  • PROJ (>= 4.9.3)

Build from Source

cd python
pip install -e .

or using setuptools directly:

cd python
python setup.py build_ext --inplace

Quick Start

import pylasr

# Create a simple processing pipeline
pipeline = (pylasr.info() + 
           pylasr.classify_with_sor(k=10) + 
           pylasr.delete_points(["Classification == 18"]) +
           pylasr.write_las("cleaned.las"))

# Set processing options
pipeline.set_concurrent_points_strategy(4)
pipeline.set_progress(True)

# Execute pipeline (returns rich results)
files = ["input.las", "input2.las"]
result = pipeline.execute(files)

API Structure

Core Classes

Pipeline

Container for multiple stages with execution management.

# Create empty pipeline
pipeline = pylasr.Pipeline()

# Add stages
pipeline += pylasr.info()
pipeline += pylasr.classify_with_sor()

# Set processing strategy
pipeline.set_concurrent_files_strategy(2)

# Execute pipeline  
result = pipeline.execute(["file1.las", "file2.las"])

Processing Strategies

LASR supports different parallelization strategies:

# Sequential processing
pipeline.set_sequential_strategy()

# Concurrent points (single file, multiple cores)
pipeline.set_concurrent_points_strategy(ncores=4)

# Concurrent files (multiple files, single core each)
pipeline.set_concurrent_files_strategy(ncores=2)

# Nested strategy (multiple files, multiple cores each)
pipeline.set_nested_strategy(ncores1=2, ncores2=4)

Available Stages

Input/Reading

  • reader() - Basic point cloud reader
  • reader_coverage() - Read points from coverage area
  • reader_circles() - Read points within circular areas
  • reader_rectangles() - Read points within rectangular areas

Classification & Filtering

  • classify_with_sor() - Statistical Outlier Removal classification
  • classify_with_ivf() - Isolated Voxel Filter classification
  • classify_with_csf() - Cloth Simulation Filter (ground classification)
  • delete_points() - Remove points by filter criteria
  • delete_noise() - Remove noise points (convenience function)
  • delete_ground() - Remove ground points (convenience function)
  • filter_with_grid() - Grid-based point filtering

Point Operations & Attributes

  • edit_attribute() - Modify point attribute values
  • add_extrabytes() - Add custom attributes to points
  • add_rgb() - Add RGB color information
  • remove_attribute() - Remove attributes from points
  • sort_points() - Sort points spatially for better performance
  • transform_with() - Transform points using raster operations

Sampling & Decimation

  • sampling_voxel() - Voxel-based point sampling
  • sampling_pixel() - Pixel-based point sampling
  • sampling_poisson() - Poisson disk sampling for uniform distribution

Rasterization & Gridding

  • rasterize() - Convert points to raster grids (DTM, DSM, CHM, etc.)
  • rasterize_triangulation() - Rasterize triangulated surfaces
  • focal() - Apply focal operations on rasters
  • pit_fill() - Fill pits in canopy height models

Geometric Analysis & Features

  • geometry_features() - Compute geometric features (eigenvalues, etc.)
  • local_maximum() - Find local maxima in point clouds
  • local_maximum_raster() - Find local maxima in rasters (tree detection)
  • triangulate() - Delaunay triangulation of points
  • hulls() - Compute convex hulls

Segmentation & Tree Detection

  • region_growing() - Region growing segmentation for tree detection

Data Loading & Transformation

  • load_raster() - Load external raster data
  • load_matrix() - Load transformation matrices

I/O Operations

  • write_las() - Write LAS/LAZ files
  • write_copc() - Write Cloud Optimized Point Cloud files
  • write_pcd() - Write Point Cloud Data files
  • write_vpc() - Write Virtual Point Cloud catalogs
  • write_lax() - Write spatial index files

Coordinate Systems

  • set_crs() - Set coordinate reference system

Information & Analysis

  • info() - Get point cloud information and statistics
  • summarise() - Generate summary statistics

Utility & Development

  • callback() - Custom callback functions for advanced processing
  • nothing() - No-operation stage for debugging
  • stop_if_outside() - Stop processing if outside bounds
  • stop_if_chunk_id_below() - Conditional processing based on chunk ID

Comparison with R API

The Python API closely mirrors the R API structure:

R Python
exec(pipeline, on = files) pipeline.execute(files)
pipeline + stage pipeline + stage
with = list(ncores = 4) pipeline.set_concurrent_points_strategy(4)
filter = "Z > 10" filter = ["Z > 10"]

Contributing

See the main LASR repository for contribution guidelines.

License

GPL-3 - see LICENSE file for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl (56.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl (56.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl (56.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl (56.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.39+ x86-64

pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl (56.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.39+ x86-64

File details

Details for the file pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 f9e20466528eb1c5de31f57bcf875216b94260e3fba5cd03fb16351941740e2c
MD5 42aeb490b08c7538613695474b89fe52
BLAKE2b-256 809e43a7ce9c6ea81aa1cd1bae990797ceddd40a9bba8f88227dacb39a7fdbec

See more details on using hashes here.

File details

Details for the file pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e8832e5a910669f8b358e8db010ae10b89a9f9b456849aaa14a1bb89fa1c9566
MD5 afe69394df309537ea889c84d9c16162
BLAKE2b-256 94e283b05040b854f3941fc4699981c663e407659781503771bfd088411f5466

See more details on using hashes here.

File details

Details for the file pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 876459c5c1d858882997cd122d9c1aed4eeab8f43803815aa0cbbba1f12ddd2e
MD5 324262da88252cb94ca480dfc11e5eb7
BLAKE2b-256 a049c66baa7c9f054e61b3fd739d2f6e4303b4c73b20488794347748602cdd16

See more details on using hashes here.

File details

Details for the file pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 af57d978ebf63d2f6d184e3bdf324df6ff1bbc75652ed20ce1b9717a150bc6f4
MD5 3d27ff220e7deb939ec6135a0b5cb247
BLAKE2b-256 ea78b3293822d6782def43dce0c7c190e86466e7774b913c6d28fdf068ce2f2a

See more details on using hashes here.

File details

Details for the file pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 4be01c3f53c1aedcc095e720c17a2f16cb8da8b9060a5ba25783ae2f6dbdd055
MD5 34c7fbb5c42cd05634ee8cbf9cff2756
BLAKE2b-256 e108cd009751fc4dd67074fc8298502fd444318fbec2c84f91d35685e65b7e06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page