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 readerreader_coverage()- Read points from coverage areareader_circles()- Read points within circular areasreader_rectangles()- Read points within rectangular areas
Classification & Filtering
classify_with_sor()- Statistical Outlier Removal classificationclassify_with_ivf()- Isolated Voxel Filter classificationclassify_with_csf()- Cloth Simulation Filter (ground classification)delete_points()- Remove points by filter criteriadelete_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 valuesadd_extrabytes()- Add custom attributes to pointsadd_rgb()- Add RGB color informationremove_attribute()- Remove attributes from pointssort_points()- Sort points spatially for better performancetransform_with()- Transform points using raster operations
Sampling & Decimation
sampling_voxel()- Voxel-based point samplingsampling_pixel()- Pixel-based point samplingsampling_poisson()- Poisson disk sampling for uniform distribution
Rasterization & Gridding
rasterize()- Convert points to raster grids (DTM, DSM, CHM, etc.)rasterize_triangulation()- Rasterize triangulated surfacesfocal()- Apply focal operations on rasterspit_fill()- Fill pits in canopy height models
Geometric Analysis & Features
geometry_features()- Compute geometric features (eigenvalues, etc.)local_maximum()- Find local maxima in point cloudslocal_maximum_raster()- Find local maxima in rasters (tree detection)triangulate()- Delaunay triangulation of pointshulls()- Compute convex hulls
Segmentation & Tree Detection
region_growing()- Region growing segmentation for tree detection
Data Loading & Transformation
load_raster()- Load external raster dataload_matrix()- Load transformation matrices
I/O Operations
write_las()- Write LAS/LAZ fileswrite_copc()- Write Cloud Optimized Point Cloud fileswrite_pcd()- Write Point Cloud Data fileswrite_vpc()- Write Virtual Point Cloud catalogswrite_lax()- Write spatial index files
Coordinate Systems
set_crs()- Set coordinate reference system
Information & Analysis
info()- Get point cloud information and statisticssummarise()- Generate summary statistics
Utility & Development
callback()- Custom callback functions for advanced processingnothing()- No-operation stage for debuggingstop_if_outside()- Stop processing if outside boundsstop_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
Metadata
Release files for pylasr 0.17.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.39+ x86-64 | Details |
| pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.39+ x86-64 | Details |
| pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.39+ x86-64 | Details |
| pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.39+ x86-64 | Details |
| pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.39+ x86-64 | Details |
Total release size: 280.6 MB
Release files / pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl
| Download URL | pylasr-0.17.4-cp313-cp313-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 56.1 MB |
| Tags | CPython 3.13 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9e20466528eb1c5de31f57bcf875216b94260e3fba5cd03fb16351941740e2c
|
|
BLAKE2b-256 checksum How to use checksums |
809e43a7ce9c6ea81aa1cd1bae990797ceddd40a9bba8f88227dacb39a7fdbec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl
| Download URL | pylasr-0.17.4-cp312-cp312-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 56.1 MB |
| Tags | CPython 3.12 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
e8832e5a910669f8b358e8db010ae10b89a9f9b456849aaa14a1bb89fa1c9566
|
|
BLAKE2b-256 checksum How to use checksums |
94e283b05040b854f3941fc4699981c663e407659781503771bfd088411f5466
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl
| Download URL | pylasr-0.17.4-cp311-cp311-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 56.1 MB |
| Tags | CPython 3.11 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
876459c5c1d858882997cd122d9c1aed4eeab8f43803815aa0cbbba1f12ddd2e
|
|
BLAKE2b-256 checksum How to use checksums |
a049c66baa7c9f054e61b3fd739d2f6e4303b4c73b20488794347748602cdd16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl
| Download URL | pylasr-0.17.4-cp310-cp310-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 56.1 MB |
| Tags | CPython 3.10 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
af57d978ebf63d2f6d184e3bdf324df6ff1bbc75652ed20ce1b9717a150bc6f4
|
|
BLAKE2b-256 checksum How to use checksums |
ea78b3293822d6782def43dce0c7c190e86466e7774b913c6d28fdf068ce2f2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl
| Download URL | pylasr-0.17.4-cp39-cp39-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 56.1 MB |
| Tags | CPython 3.9 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
4be01c3f53c1aedcc095e720c17a2f16cb8da8b9060a5ba25783ae2f6dbdd055
|
|
BLAKE2b-256 checksum How to use checksums |
e108cd009751fc4dd67074fc8298502fd444318fbec2c84f91d35685e65b7e06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|