Skip to content

About

Python tools (mainly) based on PDAL that are used to work on LiDAR data in the LidarHD project at IGNF

Resources

Stars

9 stars

Watchers

3 watching

Forks

Repository files navigation

ign-pdal-tools

Python utilities for working with LiDAR point clouds and LAS/LAZ files with PDAL. The tools were developed for the LidarHD project at IGN. The library is maintained to meet the team's needs and may change over time.

What it does

Imagery

  • color.py adds RGB, infrared, or vegetation-index values to a point cloud using imagery from Geoplateforme or a local raster.
  • download_image.py downloads georeferenced GeoTIFF imagery from Geoplateforme and combines tiled requests for large extents.

Point-cloud editing

LAS/LAZ information and quality checks

Format and pipeline utilities

  • standardize_format.py rewrites a LAS/LAZ file in the library's standard format.
  • run_pdal_pipeline.py runs a PDAL pipeline provided as JSON against an input file and writes the output file.
  • unlock_file.py works around malformed TerraSolid LAS 1.4 files with point formats 6-10 that lack the global-encoding WKT flag.
  • create_random_laz.py generates synthetic LAZ files with configurable point format, CRS, classifications, and extra dimensions for testing.

Neighboring tiles

  • las_merge.py merges a tile with its neighboring tiles.
  • las_add_buffer.py adds points from neighboring tiles along a tile's border.
  • Both tools use filenames to determine tile extents and locate neighbors. The expected pattern is {prefix1}_{prefix2}_{xcoord}_{ycoord}_{postfix}, for example Semis_2021_0770_6278_LA93_IGN69.laz. By default, coordinates are in kilometers and tiles are 1 km by 1 km.

Python examples

Read LAS metadata:

from pdaltools import las_info

metadata = las_info.las_info_metadata("input.laz")

Infer a tile origin from point-cloud bounds:

from pdaltools import las_info, pcd_info

metadata = las_info.las_info_metadata("input.laz")
bounds = las_info.get_bounds_from_header_info(metadata)
origin_x, origin_y = pcd_info.infer_tile_origin(*bounds, tile_width=1000)

Install and use

Install from PyPI:

pip install ign-pdal-tools

For development, make install creates or updates the pdaltools mamba environment from environment.yml.

To build and run the tools in Docker, see Dockerfile and the Makefile targets below.

Development

  • Create or update the environment: make install
  • Run the standard test suite: make testing (excludes tests marked geopf)
  • Run all tests, including geopf tests: make testing_full
  • Install pre-commit hooks: make install-precommit
  • Record changes in CHANGELOG.md and update the version in pdaltools/_version.py when appropriate.

Build and package commands are defined in the Makefile:

  • make build builds the Python package.
  • make deploy uploads the built package to PyPI.
  • make docker-build builds the Docker image.
  • make docker-test runs the tests in Docker.
  • make docker-build-custom-pdal builds an image with the custom PDAL version configured in the Makefile.

About

Python tools (mainly) based on PDAL that are used to work on LiDAR data in the LidarHD project at IGNF

Resources

Stars

9 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages