People like to use contour lines when they look at elevation, even when they have a point cloud of lidar data. I think this is because the contours reduce the amount of information to something they can digest and understand. Unfortunately, automated contours tend to be noisy. This point was reinforced for me recently when someone noted that the contours coming out of the Digital Coast DAV system are indeed noisy. Instead of generating the contours from a TIN, as DAV does, they suggested creating a grid first and then contouring, which DAV used to do.
How much difference does it really make and what are the trade-offs with different grid resolutions? If you grid first, the effect should be to smooth the noise, but what cell size should you use? I’m going to take a look at that in today’s post.
When we make contours of the ground, we like to think (pretend) that we’re working with a true representation of the ground. With lidar, and anything else you can think of, this isn’t true. We’ve got two main problems. First, we have a finite number of measurements to represent a potentially infinitely variable ground. We can’t really cover the ground with an infinite number of infinitely small laser measurements. Second, our measurements themselves have some degree of random error.
To examine the contouring problem, I’m going to simulate the lidar returns from a perfectly known surface. That is, I’m defining the surface itself, so I know exactly what it should be and what the contours should look like, and then simulating what I would get if I surveyed it with lidar. My defined surface starts with a 100 meter x 100 meter perfectly planar surface that slopes upward in the y-direction and is constant in the x-direction. Near the center of the surface is a 25 meter radius circular trench that is 3 meters wide and 2 meters deep. If I randomly pick points on this surface until I have 2 points per square meter (i.e. I pick 20000 points) and then make a 1 meter grid, it looks like Figure 1. You can see it is very smooth, although there is some granularity around the circle because we’re picking a finite number of points to represent it and we’ve made 1 meter cells. There’s a hillshade effect in the image causing the dark shadows in the trench.
Note that I made these points with no vertical error. Contours made using TIN interpolation from our perfect points look mostly like you’d expect, straight lines except for where our trench is (Figure 2). The contours are in feet even though the data is in meters because this is the U.S. and we tend to do crazy things like that.
Now we’ll add a little error to the points using a normal distribution with a 10 cm standard deviation and zero mean. The resulting point cloud is shown in Figure 3. This is the point cloud we’ll use for the rest of the discussion. Not much to look at, but it probably has a more uniform spatial distribution than you’d get in a typical lidar survey.
Let’s first look at what kind of contours we would get from a TIN (Figure 4). If you compare this to Figure 2, you see that it is much much noisier. The only difference was that we added the amount of noise that would be fairly typical of a lidar survey. You can see that our trench stands out well, but the horizontal straight lines contours that we expect aren’t so straight and are really hard to interpret. Note that nothing was done to try to smooth the contours, such as eliminating short segments, or other things that could improve the look and feel a little.
Well, what if we first interpolated the points onto a grid to smooth some of that noise and then made our contours. The next set of images show a grid of the interpolated points and the resulting contours for a 1-meter, 3-meter, and 5-meter grid.
As you can see from the graphics, while increasing the grid size for interpolation smooths out the straight contours that represent the constant slope of our surface, we also start to lose the trench. The 1-meter DEM or grid has a well-defined trench but noisy slope lines. Interpolating to 5 meters has come close to wiping out the trench altogether while making slope lines that we might consider acceptable. You can still tell there is some sort of feature for our trench, but it might not be a single connected feature. The 3-meter DEM looks like a reasonable compromise. Is 3-meters magical? I doubt it. Note that 3-meters is my trench width, so perhaps the optimal size is roughly the size of the features you’re trying to capture, which would make intuitive sense.
So, a few points in conclusion.
- Contours are imperfect because: a) we can’t infinitely sample the true surface; and b) our samples have inherent measurement error. This is true regardless of the technology used to create our original samples.
- Making nice contours, especially automated ones, is a trade-off between smoothing the noise and destroying detail.
- Human interpretation (which costs time and time is money) may be needed to determine where smoothing is acceptable and where detail is needed or where something like a breakline might be needed.
I hope you found something interesting in that little exercise. I’m sure there are lots of techniques out there to make contours a little smoother for human interpretation but I skipped over all of them in an effort to illustrate the base problem. It does look like the Digital Coast DAV is using one of the noisier options for contouring. It may be worth bringing back the option to grid before contouring. Then you can pick your poison.