Create Filled Contours script tool for ArcGIS 10

Contours are lines that connect locations of equal value in a raster dataset. They are useful because they can show the shape of the phenomena represented by the raster surface that may be otherwise difficult to see.

In addition to raster and contour line representations of surfaces, visualizing and symbolizing surfaces as contour polygons (Fig. 1) can provide useful capabilities.  For example, querying the particular polygon can give you the area of elevation values between 100 m and 200 m, or allow you to select the polygon that represents the perimeter of a water body, or summarize all the vegetation types within each contour range.

A script tool is available for ArcGIS 10 that allows you to create these filled contour polygons, and is downloadable from the Analysis and Geoprocessing Tool Gallery.

Figure 1: Filled contours

Figure 1: Filled contours displayed in ArcMap

This entry was posted in Analysis & Geoprocessing, Hydro, Petroleum, Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

11 Comments

  1. careyshan says:

    Hi Steve,

    Thanks for this great tool, is it possible to have various unique contour intervals such as [0.3, 10, 30.4] rather than just 100 meter intervals lets say.

    Many thanks

    • Steve Lynch says:

      Shane
      You could modify the script to rather call ContourList. You would also have to change the input parameters to then accept a list of intervals and not a single contour interval. The base contour and z factor are then not required anymore.

      Regards
      Steve

  2. marhensa says:

    Great! A new way to create bathymetry polygon!
    No need to runs this madness again: DEM Data > Reclassify > Raster to Polygon > Smoothing > Eliminate

    • sharb says:

      Hi, marhensa- would you explain in greater detail what you did for smoothing and “eliminate”? I am looking for all options to make a bathymetry polygon and would appreciate any thoughts you have. Thank you!

  3. jmscott9 says:

    Great tool – only problem for me is that I’m getting an error when trying to run the “filled contours” part. Does anyone know what this error might be:
    In the results window, after
    FeatureToLine_management…

    Traceback (most recent call last):
    File “C:\SpatialAnalystSupplementalTools\Scripts\filledcontours.py”, line 296 in execute ‘-1000000′, ‘VB’,'#’)
    File “c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py”, line 3129 , in CalculateField raise e
    ExecuteError: Failed to execute. Parameters are not valid.
    ERROR 000989: Tool CalculateField cannot use VB expressions for services
    Failed to execute (FilledContours)

    Thanks for any help!

    • Steve Lynch says:

      Jared
      If you are planning to run this script in Background 64 bit, Linux or ArcGIS for Server you’ll need to modify the filledcontours.py script. Open the script and search for CalculateField and replace VB with PYTHON, viz.,
      arcpy.CalculateField_management(outBufferContourLineLyr, 'Contour',
      '-1000000', 'PYTHON', '#')

      We will incorporate this when these script tools are updated again.

      Regards
      Steve

  4. sharb says:

    This would be a fantastic tool, but it is not running properly. Although it run “successfully” it creates an empty feature class output. The Session info shows the Error: Out of Memory, where things go haywire. I’m not sure what to do because there is plenty of memory space, and I’m not running other programs/scripts/tools at the same time. Please advise! Thank you!

  5. tacl1304 says:

    Hi Steve, I tried to run the script using the toolbox in arcmap. First I thought great it runs, but 7.5 hours later I stopped it from running without having any result yet. It was still working on FeatureToPolygon_management. Have I done anything wrong or is there anything I can do to speed up the process? I have used a DEM covering southern Alaska with a 1 km resolution. Eventually I have to obtain global coverage by reapplying this to different regions, so it would be really great if I could get this tool to work.

  6. sarah_goode says:

    Hi, I’m looking for a tool similar to this, but I have a polyline shapefile showing contours. I just want to convert them to filled polygons showing the ranges between each contour line. Is there a relatively easy way to do this?

    • sarah_goode says:

      ok, so I tried converting my polylines to raster and running the tool. But it keeps failing at “Feature to Line Management”
      I get a message “ExecuteError: Failed to execute. Parameters are not valid” as well as “ERROR 000824: the tool is not licensed.”

      I am using ArcEditor with a spatial analyst licence. Do I need ArcInfo to run this tool?