This can be done with a pdal filter using either Simple Morphological Filter (SMRF) or Progressive Morphological Filter (PMF) algorithms.
Quick
pdal ground --cell_size=5 --extract input.laz out-bare-earth.laz
Creates a bare earth compressed LAS file with a 5 ground unit cell size using PMF. (docs)
For more explanation see the Identifying ground returns using ProgressiveMorphologicalFilter segmentation tutorial.
More involved, using SMRF
A pipeline example that:
- applies the SMRF filter, enlarges the
cell
size option to 2.0 (coordinate system units) and a 0.75 threshold
- selects only the newly classified ground points (
2
is the LAS standard value for ground)
- writes selection to an uncompressed LAS output file (just change extension to .laz for compressed)
Command: pdal pipeline "classify-ground-smrf.json"
The JSON parameters file:
{
"pipeline": [
"inputfile.laz",
{
"type":"filters.smrf",
"cell": "2.0",
"threshold": "0.75"
},
{
"type":"filters.range",
"limits":"Classification[2:2]"
},
"out/smurf_classifed.las"
]
}
Extract above ground only
This example a) classifies into ground/not-ground, b) adds "Height Above Ground" attribute, and c) exports only points 2.0 (coordinate system units) above ground.
{
"pipeline": [
"input.laz",
{
"type": "filters.assign",
"assignment": "Classification[:]=0"
},
{
"type": "filters.smrf"
},
{
"type": "filters.hag"
},
{
"type": "filters.range",
"limits": "HeightAboveGround[2:]"
},
{
"filename":"above-ground.laz"
}
]
}
Adapted from Brad Chambers, https://lists.osgeo.org/pipermail/pdal/2017-July/001367.html