## Surface Smoothing Simplified

Have you ever had jagged contours that just made your entire topo look bad? It sometimes seems that no amount of additional data will make those contours look right – and that’s what it’s all about, isn’t it? The contours need to look pretty. Well, I’ve heard your moans of despair regarding those jagged contours, and I feel your pain. So, I set off to find out how to make pretty contours.

First of all, take a look at my ugly contours. By the end of this post, we’re all going to figure out how to make them look nice. Take a look…

My goal is to smooth these contours out. Click more to find out how…

What we’re going to do is smooth the surface, not the contours. Adding vertices to contours helps to make them look good, but doesn’t give us what we really need. For example, in the image above, the contours have maximum vertices added and still look bad. So we’re going to smooth the entire surface. We do this by gong to edits under the surface definition, right clicking, and selecting Smooth Surface.

That will bring up the following dialog box – I’ll show some of the settings, but talk about most of them.

For the first selection (smoothing method), we’re going to select Natural Neighbor Interpolation. This is because I don’t have the astrophysics degree required to understand the Kriging Method. Seriously, it’s more involved than I could write about in dozens of posts to this site, and I’m not 100% sure that I fully understand it. I’ll show you why in a few seconds.

First, we’ll go to the help file for information regarding Natural Neighbor Interpolation (NNI):

Use Natural Neighbor Interpolation (NNI) to estimate the elevation (Z) of an arbitrary point (p) from a set of points with known elevations.

The method uses information in the triangulation of the known points to compute a weighted average of the elevations of the natural neighbors of point p. The number of neighbors (the number of points whose Z values are averaged to get the interpolated value) is dependent on the triangulation. Itâ€™s the number of points a new point would be connected to if inserted into the surface

Using NNI, you select only the output locations of the interpolated points. The elevations of the interpolated points are always based on the weighted average of the elevations of the existing neighboring points. The outcome of the NNI method is more predictable than the Kriging method. Also, NNI interpolates only within the surface, whereas Kriging can extrapolate beyond the surface border based on a selected polygon.

Now, we’ll look at what the help file has to say regarding the Kriging method:

Kriging is more complex than Natural Neighbor Interpolation. It requires both a model of the spatial continuity or dependence (in the form of a covariance or semivariogram), and a sample of surface data to determine the statistical trend on which to base interpolated/extrapolated points.

Spatial prediction using Kriging involves two steps:

1. Model the covariance or semivariogram of the spatial process. This involves choosing both a mathematical form and the values of the associated parameters.
2. Use this dependence model in solving the Kriging system at a specified set of spatial points, resulting in predicted values and associated standard errors.
Sample Data
You must select the output locations of the interpolated points. It is important to ensure that the sample data is appropriate for the interpolated point locations (the output). For example, you should not select points on the opposite side of the surface to determine a trend for the interpolated/extrapolated points locations, as that trend may not be appropriate for the interpolated/extrapolated point locations.

Semivariogram Model
Semivariance is a measure of the degree of spatial dependence between samples. The magnitude of the semivariance between points depends on the distance between the points. A smaller distance yields a smaller semivariance and a larger distance results in a larger semivariance. The plot of the semivariances as a function of distance from a point is referred to as a semivariogram.

Kriging provides five semivariogram models:

• Exponential
• Gaussian
• Monomial
• Linear (default)
• Spherical

The semivariance increases as the distance increases until at a certain distance away from a point the semivariance will equal the variance around the average value, and will therefore no longer increase, causing a flat region to occur on the semivariogram called a sill. The distance from the point of interest to where the flat region begins is termed the range or span of the regionalized variable. Within this range, locations are related to each other, and all known samples contained in this region, also referred to as the neighborhood, must be considered when estimating the unknown point of interest.

The center of the neighborhood is usually the unknown value. To determine this value, all known values within the neighborhood are assigned weights using the semivariogram. These weights and known values are then used to calculate the unknown value.

Tip: It is recommended that you understand Kriging methodology before using it to perform surface smoothing.

See, when they put a tip like that last line in there, I know it’s not for me…
Since a) Kriging is difficult and b) NNI works for what I want to do, we’ll utilize the NNI method for this example. The first thing we have to do is select output locations. You have four selections: Grid Based, Centroids, Random Points, or Edge Midpoints. Once again, we’ll step over to the help file to understand these choices:
Grid Based Location
Use the Grid Based output location to interpolate surface points (NNI), or interpolate/extrapolate surface points (Kriging) on a grid defined within specified polygon areas selected in the drawing. After the areas are defined, the grid X and Y spacing, and orientation properties can be specified.
Centroids Location
Use the Centroids output location to interpolate surface points (NNI and Kriging) at the existing surface triangle centroids within specified polygon areas selected in the drawing.
When this option is selected, the grid X and Y spacing and the orientation properties are disabled.

Random Points Location
Use the Random Points output location to interpolate (NNI), or interpolate/extrapolate (Kriging) a specified number of random points within polygon areas selected in the drawing.

When this option is selected, the grid X and Y spacing and the orientation properties are disabled.

It should be noted that there is no information in the help file regarding Edge Midpoints. I typically use Grid Based, so we won’t worry about the Edge Midpoints. So, leaving the selection set to Grid Based, I’m now going to select the output region. This allows you to select a region, a rectangle, a polygon, or a surface. Here’s my ten-cent tip for today – don’t try to smooth the entire surface. There’s a reason for this – it puts in a LOT of points, creating a very large surface. I’ve also seen it return less than desirable results (especially inside closed feature lines used in grading.) I try to smooth small areas at a time, which allows me to control precise areas and not attempt to “fix” an area of the surface that might not need fixing. To do this, I use a polygon (or rectangle) selection to pick just the area that I want to smooth. For this exercise, I’m going to use a polygon on the area in the illustration above. Once that polygon is defined, I’ll need to set up my grid. I’m going to use an XY spacing of 2.5 feet since this is a relatively small area, and a grid rotation of 0. Once we get that set up, let’s look and see what the new contours look like (the rebuild is automatic here) –
See how much nicer they look? Let’s take a look at what it did to the TIN – you’ll be surprised…
You’ll see here that it re-triangulated using my 2.5′ grid. Think about what that would do to your drawing if you applied it to an entire surface.
Some things to consider when using surface smoothing:
1) Surface smoothing only works on TIN surfaces.
2) Surface smoothing is a VERY powerful tool.
3) Surface smoothing can totally hose a surface, so handle with care.
4) If you make a mistake and smooth your entire surface and don’t accidentally crash your drawing in the process, you can delete that surface smoothing edit.
Be careful, but have fun!
ed. note -Â  As Da Govna pointed out, he’s written about this one before, but actually went in and discussed the Kriging Method.Â Â  I thought I remembered reading a post like that, and actually took the time to search his blog and Dave & Dan blog for it, but couldn’t find it.Â Â  He did admit how hard it was to find, and was nice enough to send me a link – you can find it here.Â Â  As I said,Â  it’s powerful stuff – so powerful that ‘Bama can’t understand it that well 😉

1. governa says:

Great post Jason, with some great information on smoothing contours. This is probably one of the most frequent questions get from LDT users, becuase they have become so used to just editing contours without changing the data behind them.

I’m a little disappointed that you didn’t link to another “krigging” blog post that’s out there; I always thought it was a wicked cool post…hint, hint.

AG

2. martin cote says:

Thanks’ Jason, Good tips that will help me understanding and explaning NNI. Now, for your own knowledge, here’s a link to understand the Kriging Method. Skip the Astrophysics courses, that link is quite sufficient for what we need to know…

Thanks’ again for your hints.

MC