To compress a LiDAR LAZ file to approximately 15 points per square meter using PDAL , you can use the filters.outlier or filters.sample pipeline stages to thin the point cloud. Below is a step-by-step guide:
Method 1: Using filters.sample (Random Sampling)
This method randomly samples points to achieve the desired density.
PDAL Pipeline Example:
json Copy code
{
"pipeline": [
{
"type": "readers.las",
"filename": "input.laz"
},
{
"type": "filters.sample",
"method": "random",
"radius": 0.258 // ~15 pts/m² (1/sqrt(15) ≈ 0.258)
},
{
"type": "writers.las",
"filename": "output.laz",
"compression": "laszip"
}
]
}
Explanation:
radius is calculated as 1 / sqrt(desired_density).
For 15 pts/m² , radius ≈ 0.258 (since 1 / sqrt(15) ≈ 0.258).
method: "random" ensures uniform thinning.
Method 2: Using filters.outlier (Grid-Based Thinning)
This method uses a grid-based approach to ensure consistent spacing.
PDAL Pipeline Example:
json Copy code
{
"pipeline": [
{
"type": "readers.las",
"filename": "input.laz"
},
{
"type": "filters.outlier",
"method": "statistical",
"multiplier": 1.0,
"radius": 0.258 // ~15 pts/m²
},
{
"type": "writers.las",
"filename": "output.laz",
"compression": "laszip"
}
]
}
Explanation:
radius is set to 0.258 (same as above).
method: "statistical" with multiplier: 1.0 ensures only one point per grid cell is kept.
Running the Pipeline
Save the pipeline as thinning_pipeline.json.
Run PDAL:
bash Copy code
pdal pipeline thinning_pipeline.json
Alternative: Using filters.voxelgrid (Voxel-Based Thinning)
If you prefer voxel-based thinning:
json Copy code
{
"pipeline": [
{
"type": "readers.las",
"filename": "input.laz"
},
{
"type": "filters.voxelgrid",
"cell": 0.258 // ~15 pts/m²
},
{
"type": "writers.las",
"filename": "output.laz",
"compression": "laszip"
}
]
}
Verification
To check the resulting density:
bash Copy code
pdal info output.laz --metadata
Look for point_count and divide by the area (in m²) to confirm the density.
Summary
For random thinning: Use filters.sample with radius=0.258.
For grid-based thinning: Use filters.outlier or filters.voxelgrid.
Output: Compress with writers.las and compression="laszip".
This should give you a LAZ file with ~15 points per square meter . Adjust the radius if needed for finer control.