Overview
The DTM creation workflow involves:- Reading the point cloud file
- Removing noise
- Cleaning up invalid values
- Classifying ground points using SMRF
- Writing the result as a raster with the GDAL writer
If your point cloud already has ground points classified, you can skip directly to the reader and writer stages.
Complete DTM creation example
Workflow breakdown
Read the point cloud
Start by reading your point cloud file:This works with various formats including LAS, LAZ, and others supported by PDAL.
Remove noise
Filter out points classified as low noise (7) and high noise (18+):The
! operator excludes points matching the classification range.Prepare for ground classification
Clean up invalid return values:This ensures all points have valid return numbers before ground classification.
Classify ground points with SMRF
Use the Simple Morphological Filter (SMRF) to identify ground points:SMRF assigns classification value 2 to points identified as ground.
Write the raster output
Use the GDAL writer to create a GeoTIFF raster from ground points:Key parameters:
where='Classification == 2'- Only use ground pointsresolution=10- Output resolution in data units (feet for this example)output_type='idw'- Use Inverse Distance Weighting for interpolationwindow_size=3- Window size for IDW interpolation
Ground classification with SMRF
The Simple Morphological Filter (SMRF) is a progressive morphological filter that identifies ground points based on the assumption that the ground surface is continuous and relatively smooth. SMRF works by:- Creating an initial estimate of the ground surface
- Progressively refining this estimate using morphological operations
- Classifying points below the threshold as ground (classification 2)
GDAL writer for raster output
The GDAL writer converts point cloud data into raster format. Key options include:output_type- Interpolation method:min,max,mean,idw,count,stdevresolution- Output resolution in the same units as your point cloud coordinatesdata_type- Output data type:float32,float64,int32, etc.window_size- For IDW, the size of the search window