Topo to Raster (Spatial Analyst)

Summary

Interpolates a hydrologically correct raster surface from point, line, and polygon data.

Learn more about how Topo to Raster works

Usage

Syntax

TopoToRaster (in_topo_features, {cell_size}, {extent}, {Margin}, {minimum_z_value}, {maximum_z_value}, {enforce}, {data_type}, {maximum_iterations}, {roughness_penalty}, {discrete_error_factor}, {vertical_standard_error}, {tolerance_1}, {tolerance_2}, {out_stream_features}, {out_sink_features}, {out_diagnostic_file}, {out_parameter_file})
ParameterExplanationData Type
in_topo_features
topo_input

The Topo class specifies the input features containing the z-values to be interpolated into a surface raster.

There are six types of data accepted inputs to the Topo class: TopoPointElevation, TopoContour, TopoStream, TopoSink, TopoBoundary, TopoLake.

  • TopoPointElevation ([[inFeatures,{field}],...])

    A point feature class representing surface elevations.

    The field stores the elevations of the points.

  • TopoContour ([[inFeatures,{field}],...])

    A line feature class that represents elevation contours.

    The field stores the elevations of the contour lines.

  • TopoStream ([inFeatures,...])

    A line feature class of stream locations. All arcs must be oriented to point downstream. The feature class should only contain single arc streams.

  • TopoSink ([[inFeatures,{field}],...])

    A point feature class that represents known topographic depressions. Topo to Raster will not attempt to remove from the analysis any points explicitly identified as sinks.

    The field used should be one that stores the elevation of the legitimate sink. If NONE is selected, only the location of the sink is used.

  • TopoBoundary ([inFeatures,...])

    A boundary is a feature class containing a single polygon that represents the outer boundary of the output raster. Cells in the output raster outside this boundary will be NoData. This option can be used for clipping out water areas along coastlines before making the final output raster.

  • TopoLake ([inFeatures,...])

    A polygon feature class that specifies the location of lakes. All output raster cells within a lake will be assigned to the minimum elevation value of all cells along the shoreline.

The PointElevation, Contour, and Sink types of feature input can have a field specified that contains the z-values. There is no Field option for Boundary, Lake, or Stream input types.

TopoInput
cell_size
(Optional)

The cell size at which the output raster will be created.

This will be the value in the environment if it is explicitly set; otherwise, it is the shorter of the width or the height of the extent of the input point features, in the input spatial reference, divided by 250.

Analysis Cell Size
extent
(Optional)

The Extent class determines the extent for the output raster dataset.

Interpolation will occur out to the x and y limits, and cells outside that extent will be NoData. For best interpolation results along the edges of the output raster, the x and y limits should be smaller than the extent of the input data by at least 10 cells on each side.

The form of the Extent class is:

  • Extent (XMin, YMin, XMax, YMax)

    where:

    • XMin—The default is the smallest x coordinate of all inputs.
    • YMin—The default is the smallest y coordinate of all inputs.
    • XMax—The default is the largest x coordinate of all inputs.
    • YMax—The default is the largest y coordinate of all inputs.

The default extent is the smallest of all extents of the input feature data.

Extent
Margin
margin
(Optional)

Distance in cells to interpolate beyond the specified output extent and boundary.

The value must be greater than or equal to 0 (zero). The default value is 20.

If the Extent and TopoBoundary feature dataset are the same as the limit of the input data (the default), values interpolated along the edge of the DEM will not match well with adjacent DEM data. This is because they have been interpolated using one-half as much data as the points inside the raster, which are surrounded on all sides by input data. The Margin option allows input data beyond these limits to be used in the interpolation.

Long
minimum_z_value
(Optional)

The minimum z-value to be used in the interpolation.

The default is 20 percent below the smallest of all the input values. This setting should seldom be less than zero (sea level).

Double
maximum_z_value
(Optional)

The maximum z-value to be used in the interpolation.

The default is 20 percent above the largest of all input values.

Double
enforce
(Optional)

The type of drainage enforcement to apply.

The drainage enforcement option can be set to attempt to remove all sinks or depressions so a hydrologically correct DEM can be created. If sink points have been explicitly identified in the input feature data, these depressions will not be filled.

  • ENFORCE The algorithm will attempt to remove all sinks it encounters, whether they are "real" or "spurious". This is the default.
  • NO_ENFORCE No sinks will be filled.
  • ENFORCE_WITH_SINK Points identified as sinks in Input feature data represent known topographic depressions, and will not be altered. Any sink not identified in input feature data is considered spurious, and the algorithm will attempt to fill it.Having more than 8,000 spurious sinks causes the tool to fail.
String
data_type
(Optional)

The dominant elevation data type of the input feature data.

  • CONTOUR The dominant type of input data will be elevation contours. This is the default.
  • SPOT The dominant type of input will be point.

Specifying the relevant selection optimizes the search method used during the generation of streams and ridges.

String
maximum_iterations
(Optional)

The maximum number of interpolation iterations.

The number of iterations must be greater than zero. A default of 40 is normally adequate for both contour and line data.

A value of 30 will clear fewer sinks. Rarely, higher values (45–50) may be useful to clear more sinks or to set more ridges and streams. Iteration ceases for each grid resolution when the maximum number of iterations has been reached.

Long
roughness_penalty
(Optional)

The integrated squared second derivative as a measure of roughness.

The roughness penalty must be zero or greater. If the primary input data type is CONTOUR, the default is zero. If the primary data type is SPOT, the default is 0.5. Larger values are not normally recommended.

Double
discrete_error_factor
(Optional)

The discrete error factor is used to adjust the amount of smoothing when converting the input data to a raster.

The value must be greater than zero. The normal range of adjustment is 0.5 to 2, and the default is 1. A smaller value results in less data smoothing; a larger value causes greater smoothing.

Double
vertical_standard_error
(Optional)

The amount of random error in the z-values of the input data.

The value must be zero or greater. The default is zero.

The vertical standard error may be set to a small positive value if the data has significant random (non-systematic) vertical errors with uniform variance. In this case, set the vertical standard error to the standard deviation of these errors. For most elevation datasets, the vertical error should be set to zero, but it may be set to a small positive value to stabilize convergence when rasterizing point data with stream line data.

Double
tolerance_1
(Optional)

This tolerance reflects the accuracy and density of the elevation points in relation to surface drainage.

For point datasets, set the tolerance to the standard error of the data heights. For contour datasets, use one-half the average contour interval.

The value must be zero or greater. The default is 2.5 if the data type is CONTOUR and zero if the data type is SPOT.

Double
tolerance_2
(Optional)

This tolerance prevents drainage clearance through unrealistically high barriers.

The value must be greater than zero. The default is 100 if the data type is CONTOUR and 200 if the data type is SPOT.

Double
out_stream_features
(Optional)

The output line feature class of stream polyline features and ridge line features.

The line features are created at the beginning of the interpolation process. It provides the general morphology of the surface for interpolation. It can be used to verify correct drainage and morphology by comparing known stream and ridge data.

Feature Class
out_sink_features
(Optional)

The output point feature class of the remaining sink point features.

These are the sinks that were not specified in the sink input feature data and were not cleared during drainage enforcement. Adjusting the values of the tolerances, tolerance_1 and tolerance_2, can reduce the number of remaining sinks. Remaining sinks often indicate errors in the input data that the drainage enforcement algorithm could not resolve. This can be an efficient way of detecting subtle elevation errors.

Feature Class
out_diagnostic_file
(Optional)

The output diagnostic file listing all inputs and parameters used and the number of sinks cleared at each resolution and iteration.

File
out_parameter_file
(Optional)

The output parameter file listing all inputs and parameters used, which can be used with Topo to Raster by File to run the interpolation again.

File

Return Value

NameExplanationData Type
out_surface_raster

The output interpolated surface raster.

Raster

Code Sample

TopoToRaster example 1 (Python window)

This example creates a hydrologically correct TIFF surface raster from point, line, and polygon data.

import arcpy
from arcpy import env  
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outTTR = TopoToRaster([TopoPointElevation([['spots.shp', 'spot_meter']]), 
                       TopoContour([['contours.shp', 'spot_meter']])], 60, 
                       "#", "#", "#", "#", "NO_ENFORCE")
outTTR.save("C:/sapyexamples/output/ttrout.tif")
TopoToRaster example 2 (stand-alone script)

This example creates a hydrologically correct GRID surface raster from point, line, and polygon data.

# Name: TopoToRaster_Ex_02.py
# Description: Interpolates a hydrologically correct surface 
#    from point, line, and polygon data.
# Requirements: Spatial Analyst Extension
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inPointElevations = TopoPointElevation([['spots.shp', 'spot_meter'], 
                                        ['spots2.shp', 'elev']])
inBoundary = TopoBoundary(['boundary.shp'])
inContours = TopoContour([['contours.shp', 'spot_meter']])
inLake = TopoLake(['lakes.shp'])
inSinks = TopoSink([['sink1.shp', 'elevation'], ['sink2.shp', 'none']])
inStream = TopoStream(['streams.shp'])

inFeatures = ([inPointElevations, inContours, inLake, inBoundary, inSinks])

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute TopoToRaster
outTTR = TopoToRaster(inFeatures)

# Save the output 
outTTR.save("C:/sapyexamples/output/ttrout03")

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst or 3D Analyst
ArcEditor: Requires Spatial Analyst or 3D Analyst
ArcInfo: Requires Spatial Analyst or 3D Analyst

6/29/2011