Contour maps of surfaces (topographic or other) can be derived from grid, DEM or TIN representations, or may be sourced from vector datasets such as those produced by national mapping agencies. Contours are lines of equal value on a surface and are thus level sets — lines that may be generated by flooding a surface to a specified level or by slicing a surface horizontally. Where contours are generated from grid data they tend to be interpolated linear segments or smoothed segments derived from linear interpolation. If grid data are viewed as a set of grid lines rather than cells, the line intersections or grid nodes have values. A straight line segment of constant value (e.g. 480m) can be constructed from pairs of NS and EW nodes by simple linear interpolation (Figure 6‑32). The result is a polyline with vertices at each grid line intersection and a constant value (e.g. elevation estimate).

Figure 6‑32 Linear interpolation of contours

The polylines so generated may then be smoothed in a variety of ways — the most common being to fit a spline function to the straight line segments and interpolate a denser set of points that may be plotted to provide a smooth set of contours. Note that independently smoothed contours can result in separate contours crossing, so the procedure needs to be carried out with care. Alternatively input grids may be resampled to provide a finer resolution input or pre-smoothed using mathematical or map algebra operations with contouring conducted on the resultant revised dataset. For TIN datasets linear interpolation is typically the only choice, with post-computation polyline smoothing as an option.

Figure 6‑33 illustrates the standard process using the sample TQ81NE region represented as a DEM and using TNTMips software. As noted earlier, there appear to be artifacts (linear forms) represented in the flat regions of the source data. Figure 6‑33B shows contours generated using simple linear interpolation, with a close-up of a section of the surface provided in Figure 6‑33C. The angular form of some line elements is reduced in Figure 6‑33D using the iterative thresholding procedure provided as a standard option in TNTMips. This is essentially a form of bicubic spline smoothing. A similar result, often with even smoother curves, is obtained if the input file is pre-smoothed using simple weighted average or Gaussian smoothing over a sample window, e.g. a 3x3 or 5x5 window, and then linear interpolation applied. ArcGIS recommends using pre-smoothing of grids with a 3x3 weighting matrix and the map algebra operation Focal Sum (Weight option) with a custom weight of 0.96 for the central cell and the remaining 8 cells weighted to 0.005.

Figure 6‑33 Contour computation output

A. Source terrain map |
B. Contour map |

C. Contour — linear close-up |
D. Contour — bicubic iterative thresholding |