# Identifying ground¶

This exercise uses PDAL to classify ground returns using the Simple Morphological Filter (SMRF) technique.

Note

This excerise is an adaptation of the pcl_ground tutorial on the PDAL website by Brad Chambers. You can find more detail and example invocations there.

## Exercise¶

The primary input for Digital Terrain Model generation is a point cloud with ground vs. not-ground classifications. In this example, we will use an algorithm provided by PDAL, the Simple Morphological Filter technique to generate a ground surface.

You can read more about the specifics of the SMRF algorithm from [Pingle2013]_

### Command¶

Invoke the following command, substituting accordingly, in your Conda Shell:

 1 2 3 4 pdal translate ./exercises/analysis/ground/CSite1_orig-utm.laz \ -o ./exercises/analysis/ground/ground.laz \ smrf \ -v 4 
 1 2 3 4 pdal translate ./exercises/analysis/ground/CSite1_orig-utm.laz ^ -o ./exercises/analysis/ground/ground.laz ^ smrf ^ -v 4 

As we can see, the algorithm does a great job of discriminating the points, but there’s a few issues.

There’s noise underneath the main surface that will cause us trouble when we generate a terrain surface.

### Filtering¶

We do not yet have a satisfactory surface for generating a DTM. When we visualize the output of this ground operation, we notice there’s still some noise. We can stack the call to SMRF with a call to a the filters.outlier technique we learned about in denoising.

1. Let us start by removing the non-ground data to just view the ground data:

 1 2 3 4 5 6 pdal translate \ ./exercises/analysis/ground/CSite1_orig-utm.laz \ -o ./exercises/analysis/ground/ground.laz \ smrf range \ --filters.range.limits="Classification[2:2]" \ -v 4 
 1 2 3 4 5 6 pdal translate ^ ./exercises/analysis/ground/CSite1_orig-utm.laz ^ -o ./exercises/analysis/ground/ground.laz ^ smrf range ^ --filters.range.limits="Classification[2:2]" ^ -v 4 

2. Now we will instead use the translate command to stack the filters.outlier and filters.smrf stages:

 1 2 3 4 5 6 7 8 9 pdal translate ./exercises/analysis/ground/CSite1_orig-utm.laz \ -o ./exercises/analysis/ground/denoised-ground-only.laz \ outlier smrf range \ --filters.outlier.method="statistical" \ --filters.outlier.mean_k=8 --filters.outlier.multiplier=3.0 \ --filters.smrf.ignore="Classification[7:7]" \ --filters.range.limits="Classification[2:2]" \ --writers.las.compression=true \ --verbose 4 
 1 2 3 4 5 6 7 8 9 pdal translate ./exercises/analysis/ground/CSite1_orig-utm.laz ^ -o ./exercises/analysis/ground/denoised-ground-only.laz ^ outlier smrf range ^ --filters.outlier.method="statistical" ^ --filters.outlier.mean_k=8 --filters.outlier.multiplier=3.0 ^ --filters.smrf.ignore="Classification[7:7]" ^ --filters.range.limits="Classification[2:2]" ^ --writers.las.compression=true ^ --verbose 4 

In this invocation, we have more control over the process. First the outlier filter merely classifies outliers with a Classification value of 7. These outliers are then ignored during SMRF processing with the ignore option. Finally, we add a range filter to extract only the ground returns (i.e., Classification value of 2).

The result is a more accurate representation of the ground returns.