# Lidar Contours

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.

1. 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.
2. Making nice contours, especially automated ones, is a trade-off between smoothing the noise and destroying detail.
3. 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.

## 2 comments

1. I am keen to know how did you simulate the small footprint LiDAR returns? any reference?

Like

2. I wrote a small python script to simulate the lidar returns. You can pick it up at ftp://coast.noaa.gov/pub/crs/kwaters/pointcloud_ring_simulation.py if you want. It hasn’t been heavily commented or had all the parameters turned into command line arguments, but you should be able to figure it out. The returns themselves are assumed to have zero spatial extent, though I don’t think that affects the results beyond not having to think about multiple returns at the ring edges.

There is one area that I think may have resulted in noisier contours in my simulation than you would normally see. I assumed a zero mean bias, all the uncertainty was in the standard deviation, and there is no spatial autocorrelation of the error. For my small area, there likely would be spatial autocorrelation because only one GPS measurement would have been involved, so the GPS error would be same for all the points. A similar issue would be true for the IMU errors, though there may be a few more measurements involved. So, it might have been more realistic to simulate a 10 cm RMSE using a non-zero mean bias and a smaller standard deviation.

Like

This site uses Akismet to reduce spam. Learn how your comment data is processed.