ESRI TIN to Elevation Contour Shapefile

This article demonstrates how to convert an ESRI TIN file to an elevation contour shapefile using ArcGIS and the 3D Analyst and (optionally) Spatial Analyst extensions.

TIN versus Elevation Contours

A Triangulated Irregular Network (TIN) is a vector representation of a ground surface. An elevation contour dataset represents lines of equal elevation.

TIN surface with overlaid contours

TIN surface with overlaid contours

While both formats store elevation data, TINs are less widely supported in GIS and CAD packages. They are also more computationally intensive to render, and large datasets can take a long time to draw on screen. In addition, ESRI TIN and Terrain Datasets are in proprietary format and are only supported by ESRI software products making it very difficult to share with other software applications.

Elevation contours on the other hand are faster to render, and are supported by a wider variety of software applications.

Conversion to Elevation Raster Preparation

While it is possible to convert a TIN directly to a contour shapefile, better results are achieved by first converting the TIN to an elevation raster (grid) and then creating contours from the elevation raster. Contours produced directly from a TIN file tend to contain topological errors and have rough jagged edges. Contours produced from an elevation raster tend to be smoother, more aesthetically pleasing, and contain fewer topological errors.

TIN based contours versus Grid based contours

This article will utilize an elevation grid for creation of the contour shapefile. For instructions on how to create an elevation raster from a TIN, see this article.

Filtering of Elevation Grid (optional)

Before creating contours from the elevation raster, it is a good idea to first filter the input raster in order to remove any anomalous cells. This reduces the number of isolations (small, insignificant peaks) created by the contour tool.

Note: This tool requires the Spatial Analyst extension. If this extension is not available, continue on to the next step and use the unfiltered raster.

To enable the Spatial Analyst extension, follow these steps:

  1. Open ArcCatalog.
  2. From the ArcCatalog main menu, select Customize | Extensions to display the Extensions dialog box.
    ArcCatalog
  3. From the displayed dialog box, check the Spatial Analyst option to enable the extension. Then, click the [Close] button.
    Enable3DAnalyst
  4. In ArcCatalog, click the Search button. This will open the Search panel.
    SearchButton
  5. In the displayed Search panel, select Tools, type filter in the search field, and then press Enter. The software will list the Filter (Spatial Analyst) tool in the search results.
    04_Search_Filter
  6. Click to blue tool name to open the Filter dialog box.
  7. In the Filter dialog box shown below, select the elevation raster file for the Input Raster field by clicking the browse button.
  8. In the Output Raster field, select a destination folder and file name using the browse button. The file extension determines the type of image that will be created. It is recommended to save the filtered image as an ERDAS Imagine (.img) file, as .img files do not have any file size or file name length limitations.
  9. In the Filter Type dropdown combo box, select the LOW option. High pass filtering enhances the visibility of edges and small features, whereas low pass filtering blends small features into the surrounding pixels.
  10. Check the Ignore NoData in calculations check box. Leaving this check box unchecked would include the NoData (empty) areas in the filter, causing distortions to the edge of the raster.
  11. Click the [OK] button to run the Filter tool.
    05_Filter_Dialog

Generating Contours

The next step is to generate the contours from the elevation raster file.

To generate the contours from the elevation raster, follow these steps:

  1. In ArcCatalog, click the Search button. This will open the Search panel.
    Search Button
  2. In the displayed Search panel, select Tools, type contour in the search field, and then press Enter. The software will list the Contour (3D Analyst) tool in the search results.
    06_Search_Contour
  3. Click to blue tool name to open the Contour dialog box
  4. In the Contour dialog box shown below, select the previously filtered elevation raster file for the Input Raster field by clicking the browse button.
  5. In the Output Polyline Features field, select a destination folder and file name using the browse button.
  6. Enter 2 in the Contour Interval field. The contour interval is measured in the same units as the elevation raster. The contour interval determines how many units will be represented by each contour. In this example, each contour line represents 2 feet.
  7. In the Base Contour field, use the default value of 0.
  8. In the Z Factor field, use the default value of 1.
  9. Click the [OK] button to run the Contour tool.
    07_Contour_Dialog

When entering a file name for the Output Polyline Features field, the file extension determines what file format the contour polylines will be saved as. For example, entering “contours.shp” will save the contours as an ESRI shapefile. Shapefiles are more widely supported in other software applications. However, shapefiles have a 2 gigabyte file size limit.

The Base Contour field is used to optionally define a starting elevation for the contour lines. This allows you to limit the number of contours generated. For example, entering 200 will cause contour lines to be created at 200 ft, 202 ft, 204 ft, etc.

The Z Factor field is used to convert between different elevation units. For example, if the elevation raster units are in meters and you need the contours units in feet, you would enter a Z Factor of 3.28084 (i.e., 3.28084 feet = 1 meter). Conversely, if the elevation raster units are in meters and you need the contours units in meters, you would enter a Z Factor of 0.3048 (i.e., 0.3048 meter = 1 foot).

Simplifying Contours

The contours that were created in the previous process can contain spikes and other errors—especially in flat areas. To remove these errors, the simplify filter can be run on the contour lines.

To simplify the contours, follow these steps:

  1. In ArcCatalog, click the Search button. This will open the Search panel.
    SearchButton
  2. In the displayed Search panel, select Tools, type simplify line in the search field, and then press Enter. The software will list the Simplify Line (Cartography) tool in the search results.
    08_Search_SimplifyLine
  3. Click to blue tool name to open the Simplify Line dialog box
  4. In the Simplify Line dialog box shown below, select the previously created contour shapefile for the Input Features field by clicking the browse button.
  5. In the Output Feature Class field, select a destination folder and file name using the browse button. The same file cannot be used as the input file—make certain to define a different file name or file path.
  6. In the Simplification Filter dropdown combo box, select the POINT_REMOVE option. This option works by maintaining the essential shape of the lines and removing any unnecessary vertices.
  7. Enter 1 in the Maximum Allowable Offset field.
  8. Check the Check for topological errors and Resolve topological errors check boxes. These options check for and remove crossed lines, zero length lines, and other topological errors.
  9. Click the [OK] button to run the Simplify Line tool.
    SimplifyLine_Dialog

Depending on the size and complexity of the contour line data, this tool can take a few minutes or up to an hour to run.

There is no rule on what value to enter for the Maximum Allowable Offset field. Smaller values remove less vertices, but also retain more detail. Smaller values are generally used in steeper terrain areas. Larger values remove more vertices, but also simplify the lines more. Larger values are generally used in flatter terrain areas. Trial and error is used to determine an appropriate value to use. The Simplify Line tool can be run multiple times on the same dataset; each iteration overwrites the previous results. It is not necessary to run the Simplify Line tool on a fresh copy of the contour shapefile each time.

Check the Contour Results

Once the Simplify Lines tool has completed, open the simplified contour shapefile in ArcMap to check for any errors. The below image shows the computed contours overlaid on the elevation raster.

10_Contours

About the Author Chris Maeder

Chris Maeder

Chris is an experienced civil engineering and software technology leader, with over 30 years industry experience. With proven expertise in global software development, he has built engineering teams that adapt quickly, focus on what’s important and, most importantly, deliver. He is a licensed professional civil engineer with extensive experience in water resource engineering. He has performed and supervised engineering projects in urban stormwater drainage, transportation and roadway drainage, storm sewer design, detention pond design, stormwater quality, green infrastructure, watershed management planning, wastewater sewers, water distribution networks, pump stations, FEMA flood studies, bridge and culvert design, bridge scour and armoring, dam failure analysis, seepage and groundwater modeling, and environmental permits.

Related Articles