A Python wrapper for PotreeConverter that provides a clean CLI interface using Pydantic for parameter validation. This wrapper makes it easy to convert LAS/LAZ point cloud files into Potree's octree format for web-based visualization.
PotreeConverter generates an octree LOD structure for streaming and real-time rendering of massive point clouds. The results can be viewed in web browsers with Potree.
Original Repository: https://github.com/potree/PotreeConverter
- ✅ Core PotreeConverter parameters exposed - Conversion, sampling, encoding, attributes, and page generation
- ✅ Type-safe parameter validation - Using Pydantic for robust input validation
- ✅ Multiple parameter aliases - Supports both Python-style (
--output_dir) and CLI-style (--output-dir) naming - ✅ Slim Docker image - ~200-250MB using Python 3.11-slim base
- ✅ Pre-built binary - Uses official PotreeConverter 2.1.1 release from GitHub
- ✅ Multi-attribute special coloring - Adds optional neighbor-aware coloring dimensions while preserving source RGB
- ✅ Comprehensive logging - Detailed execution logs with timestamps
docker build -t 3dtrees_potree .Convert a single LAS/LAZ file:
docker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input.las \
--outdir /data/outputConvert all files in a directory:
docker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input_dir \
--outdir /data/output| Parameter | Alias | Type | Default | Description |
|---|---|---|---|---|
--source |
-i |
List[str] | required | Input file(s) or directory containing LAS/LAZ files |
--outdir |
-o |
Path | auto-generated | Output directory |
--encoding |
str | BROTLI |
Encoding type: BROTLI, UNCOMPRESSED, DEFAULT |
|
--method |
-m |
str | poisson |
Sampling method: poisson, poisson_average, random |
--chunk-method |
str | LASZIP |
Chunking method | |
--attributes |
List[str] | [] |
Attributes in output file | |
--special-coloring |
bool | False |
Add instance-based coloring dimensions before conversion | |
--special-coloring-palette |
str | candy |
Palette name or comma-separated #RRGGBB colors for special coloring |
|
--special-coloring-n-colors |
int | 10 |
Number of non-ground coloring IDs | |
--special-coloring-n-neighbors |
int | 10 |
Number of nearest instance centroids used to avoid nearby color collisions | |
--special-coloring-instance-attributes |
List[str] | PredInstance_SAT, PredInstance_FoMa |
Instance attributes to color; comma-separated or repeated values are supported | |
--special-coloring-instance-attribute |
str | None |
Backward-compatible single instance attribute override | |
--special-coloring-ground-id |
int | 0 |
Instance ID treated as ground/background; negative instance IDs are also treated as background | |
--special-coloring-ground-color |
str | #808080 |
Ground/background color | |
--special-coloring-sidecar-json |
bool | False |
Write special_coloring_mapping.json and patch generated Potree HTML viewers to use it |
|
--keep-chunks |
bool | False |
Skip deleting temporary chunks | |
--no-chunking |
bool | False |
Disable chunking phase | |
--no-indexing |
bool | False |
Disable indexing phase | |
--generate-page |
-p |
str | None |
Generate web page with given name |
--title |
str | None |
Page title for generated web page |
docker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input.las \
--outdir /data/output \
--method poisson_averagedocker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input.las \
--outdir /data/output \
--encoding BROTLIdocker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/file1.las /data/file2.las /data/file3.las \
--outdir /data/outputdocker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input.las \
--outdir /data/output \
--generate-page mycloud \
--title "My Point Cloud Visualization"docker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input.las \
--outdir /data/output \
--method random \
--encoding BROTLI \
--attributes intensity classification \
--keep-chunksPreserve original RGB while adding display-only coloring attributes based on instance extra dimensions. By default, --special-coloring reads PredInstance_SAT and PredInstance_FoMa. Bare PredInstance and PredInstance_SAT produce coloring_id_sat. If the input uses PredInstance_FM, it is accepted as the FoMa alias and produces coloring_id_fm.
docker run --rm --cpus=10 --memory=50g -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input_segmented.laz \
--outdir /data/output \
--special-coloring \
--special-coloring-sidecar-jsonCustom attributes may be repeated or comma-separated:
docker run --rm -v /path/to/data:/data 3dtrees_potree \
python /src/run.py \
--source /data/input_segmented.laz \
--outdir /data/output \
--special-coloring \
--special-coloring-instance-attributes PredInstance_SAT,PredInstance_FMThis adds one coloring dimension per requested instance attribute to the generated Potree point cloud. When --special-coloring-sidecar-json is set, the tool writes mapping JSON files to the output directory, copies them beside generated metadata.json files for frontend discovery, and patches generated Potree HTML viewers to use the first sidecar color mapping. Instance values equal to the ground ID, and negative instance values such as -1, map to coloring ID 0.
Built-in special coloring palettes are sky, sea, cozy, fairy, winter, rainbow, pastel, candy, and boring.
docker run --rm 3dtrees_potree python /src/run.py --help.
├── Dockerfile # Docker image definition
├── src/
│ ├── parameters.py # Pydantic parameter definitions
│ ├── run.py # Main execution script
│ └── special_coloring.py # Instance coloring preprocessing
├── tests/ # Unit tests for wrapper logic
└── README.md # This file
- parameters.py - Defines all PotreeConverter parameters using Pydantic's
BaseSettingsclass with CLI argument parsing - run.py - Parses CLI arguments, builds the PotreeConverter command, and executes it via subprocess
- Dockerfile - Creates a slim image with Python 3.11, PotreeConverter binary, and Python dependencies. The image intentionally leaves entrypoint control to callers so Galaxy can launch its generated shell script.
Tested with: 1.6M points, 10.5 MB LAZ file
Conversion time: ~5 seconds
Throughput: ~0.3M points/second
Memory usage: ~8GB peak
Performance scales with input size and available CPU cores (automatically uses all available threads).
PotreeConverter 2.0 produces:
- 3 files total (instead of thousands in v1.7)
- Octree LOD structure for efficient streaming
- Compatible with Potree 1.7+ viewer
- Optional web page with embedded viewer
With --special-coloring-sidecar-json, the output directory also contains:
- special_coloring_mapping.json*: Mapping from coloring IDs to RGB/hex colors and from each instance attribute to its coloring IDs
- Docker
- Input: LAS/LAZ point cloud files
- Sufficient disk space for output (typically similar to input size)
This wrapper is provided as-is. PotreeConverter itself is licensed under the BSD 2-clause license.
- PotreeConverter: https://github.com/potree/PotreeConverter
- Potree Viewer: https://github.com/potree/potree
- Paper: Fast Out-of-Core Octree Generation for Massive Point Clouds
Ensure the mounted volume has proper permissions:
chmod -R 755 /path/to/dataFor very large point clouds, ensure Docker has sufficient memory allocated (8GB+ recommended).
Make sure to use absolute paths and verify the file exists in the mounted volume:
ls -la /path/to/data/