A Digital Terrain Model is the bare ground with buildings, vegetation and everything else above it removed — seeDEM vs DSM vs DTM if that distinction is not yet settled. Producing one from apoint cloud takes four steps:
- Classify which points are bare ground.
- Filter to keep only those.
- Rasterise them onto a grid.
- Interpolate across the cells with no ground point.
Step 1 is the whole problem. Steps 2 to 4 are mechanical, and LAS to DEM runs all three in the browser. Almost every complaint about a bad terrain model traces back to step 1 — so most of this article is about that, and about the specific features that defeat it.
Step 1: Classify the ground
Ground classification decides, for every point, whether it is bare earth or something standing on it. Nothing in the measurement itself says which — a point is a coordinate, and a roof point and a pavement point are indistinguishable in isolation. The decision has to come fromcontext: what is around a point, and how it sits relative to its neighbours.
Every practical algorithm rests on the same assumption: terrain varies smoothly, and objects introduce steps that terrain does not. A hillside can climb steadily for a kilometre; a building wall rises four metres in twenty centimetres and stops. The families in common use differ in how they exploit that:
| Approach | How it works | Where it struggles |
|---|---|---|
| Morphological filters | Repeatedly "open" a minimum-elevation surface with growing windows, removing what rises above the result at each step. | A fixed height threshold must be generous on steep terrain — and then a low, wide roof fits inside it. |
| TIN densification | Seed a triangulated surface with confident low points, then admit further points only if they sit within an angle and distance tolerance of the current surface. | Seeding badly on a large building; gradual ramps into structures. |
| Cloth simulation | Invert the cloud and drop a virtual cloth onto it; points near where the cloth settles are ground. | Very wide flat roofs, where the sheet gathers momentum and settles on the roof instead of beside it. |
| Surface fitting | Fit a smooth surface robustly, downweighting points far above it, and iterate. | Terrain with genuine sharp breaks, which robust fitting tends to round off. |
All of these are heuristics. None derives ground from first principles, because there is no such derivation available — the information simply is not in the data. They encode a reasonable idea about what landscapes look like, and they fail where a landscape disagrees.
The large flat roof problem
Worth singling out, because it is the failure everyone eventually meets. A big warehouse or supermarket roof is flat, level, and can span a hundred metres. At that scale it looks exactly like terrain: smooth, continuous, slowly varying. Filters tuned to preserve a hillside will preserve it too, and it survives into the terrain model as a plateau.
The classifier on this site meets it with aSimple Morphological Filter (Pingel, Clarke & McBride, 2013), chosen specifically for this case. Rather than testing height above the opened surface against an absolute threshold, SMRF tests theincrement each window step removes. A wide roof disappears entirely in the single step whose window first spans it, producing a drop far larger than the per-step allowance — while a hillside can only ever lose so much per step no matter how far it runs. That difference is what separates a 50-metre roof from steep ground, and it is why a progressive morphological filter and a cloth simulation were both tried on a dense photogrammetric survey of an industrial site and both left the warehouse roofs in the ground model.
Doing it here
Classify a LAS or LAZ file in your browser. Ground is written as ASPRS class 2, vegetation as 3, 4 and 5 by height, and buildings as 6. Nothing is uploaded.
Two honest caveats. It was built for photogrammetric clouds with no return information — the case where conventional LiDAR ground filters have least to work with — and it uses RGB colour where the cloud carries it. And, like every automatic classifier, its output is a proposal. Anything above ground that is neither roof nor foliage — vehicles, fences, poles, machinery — it deliberately leaves unclassified rather than guessing.
Checking the classification before you rasterise
This is the step most often skipped and most worth doing, because errors are visible in the points and invisible in the finished raster.
- Open the classified file and colour by classification. Rotate to a low angle — errors that are invisible from directly above stand out immediately in profile.
- Look specifically at large buildings, dense woodland, water margins and the steepest slopes. These are where every algorithm is weakest.
- Check theclassification histogram. The ground share should be plausible for the terrain: a wooded site reporting 90% ground has classified canopy as earth, and an open field reporting 15% has thrown most of the ground away.
Step 2: Filter to ground points
Mechanical: keep class 2, discard the rest. Two details are worth attention. Points flagged withheld should be dropped regardless of class — that flag means the producer marked the point as unusable. And if the data carries overlap points, from the edges of adjacent flight lines, many workflows exclude them too, since they are the least accurate points in the file.LAS classification codescovers where those flags live.
Step 3: Rasterise
Impose a grid and reduce the ground points falling in each cell to a single elevation. Common reductions are the mean of the points in the cell, the minimum, or a fitted plane. Mean is the usual default; minimum biases the surface downward toward any surviving noise.
Cell size is the decision that matters, and it should follow the ground point density, not the overall density. A cloud averaging 8 points/m² across a wooded site might deliver only 1 ground point/m² under the trees. As a working rule, choose a cell that most cells will contain at least a few ground points; then check what proportion came out empty.
| Ground point spacing | Comfortable cell size | What a finer grid buys |
|---|---|---|
| ~2 m | 2–5 m | Nothing. Interpolation only. |
| ~1 m | 1–2 m | Little. |
| ~0.5 m | 0.5–1 m | Some detail at kerbs and ditches. |
| ~0.1 m | 0.1–0.25 m | Genuine micro-topography. |
A finer grid than the data supports produces a larger file, a slower workflow and a more detailed-looking product containing no more information. It is a common way to make a deliverable look better and be worse.
Step 4: Interpolate the gaps
After filtering, every building footprint is a hole, as is every patch of dense vegetation and every stretch of water. These cells have to be filled from the ground points around them.
Inverse distance weighting, natural neighbour, spline and kriging are the usual choices, and for a well-sampled surface they differ less than their partisans suggest. What matters more is the size of the gap. Interpolating two metres across a hedge line is reliable. Interpolating eighty metres across a warehouse means the terrain under that building is an assumption, presented at the same visual fidelity as the measured ground beside it. Nothing in the output raster distinguishes the two — which is the strongest argument for keeping the point cloud alongside the DTM you derived from it.
What goes wrong
| Feature | What happens | What to do |
|---|---|---|
| Dense vegetation | Few or no pulses reach the ground; terrain is interpolated over long distances and any surviving low return becomes a bump. | Expect lower accuracy there. Check against ground control if it matters. |
| Low scrub and long grass | Returns merge with the ground echo and cannot be separated, so the surface sits slightly high. | Largely unfixable. A known systematic bias, not a blunder. |
| Large flat roofs | Survive as plateaux in the terrain, as described above. | Use a filter that tests increments; inspect large structures specifically. |
| Bridges | Deck left in place dams the valley; removed, it leaves a gap. | Decide the convention deliberately and document it. |
| Water | Absorbs the beam, returning little — lakes appear as holes, not flat surfaces. | Flatten water bodies explicitly with a breakline if the model needs them level. |
| Low noise | Multipath returns below the true surface drag the terrain down, and minimum-based reductions chase them. | Remove class 7 before filtering. A single bad point can pull a wide area. |
| High noise | Birds, haze and cloud. Usually harmless to a DTM, since they are far above ground. | Remove class 18 anyway. |
| Steep terrain | Settings loose enough to keep a cliff also keep buildings; tight enough to remove buildings also shaves the cliff. | The central tension. Tune per site, or process steep areas separately. |
| Flight line overlap | Doubled density and a possible vertical step between strips. | Exclude overlap points, or fix the strip adjustment upstream. |
Doing this here
Step 1 is the step that decides whether the terrain model is any good, and it runs in your browser on your own machine — along with everything needed to check it:
- Classify ground, vegetation and buildings— step 1, the step that decides quality.
- View and check the classification in 3D, coloured by class, with a statistics panel giving the exact count in each.
- Inspect the header and CRS before starting, so the output lands in the right coordinate system.
- Open the finished terrain raster, hillshaded and in 3D — buildings should be gone, and the ground should not be lumpy where they were.
Steps 2 to 4 consume the classified file, and LAS to DEM runs them: it drops noise and withheld points, keeps class 2 (or applies its own ground filter if the file is unclassified), grids at your cell size and fills gaps up to the distance you set. Getting step 1 right is what makes those steps worth running, which is why it is worth spending the time on the classification and the check rather than on the interpolator.
A worked sequence
- Inspect the file: point count, point format, coordinate system, and whether it is already classified.
- If the classification is absent or untrustworthy,run the classifier (experimental).
- Open the result and check it at a low angle over buildings, woodland and slopes.
- Build the DTM: noise classes 7 and 18 and withheld points are removed, the cloud is filtered to class 2, and the ground is rasterised at a cell size the density supports.
- Set the fill distance so small gaps are interpolated and large ones — buildings, water, the edge of the block — are left as nodata; note where the large ones are.
- Open the output and hillshade it. Buildings should be gone; the ground should not be lumpy where they were.
If step 8 looks wrong, the fix is nearly always back at step 2, not in the interpolator.