You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Interpolation (Spatial Analyst)

# IDW

Release 9.3   Print all topics in : "Interpolation (Spatial Analyst)"

Interpolates a surface from points using an inverse distance weighted (IDW) technique.

Usage tips

Command line and Scripting

• The output value for a cell using IDW is limited to the range of the values used to interpolate. Because IDW is a weighted distance average, the average cannot be greater than the highest or less than the lowest input. Therefore, it cannot create ridges or valleys if these extremes have not already been sampled (Watson and Philip, 1985).

• The influence of an input point on an interpolated value is isotropic. Since the influence of an input point on an interpolated value is distance related, IDW is not "ridge preserving" (Philip and Watson, 1982).

• The best results from IDW are obtained when sampling is sufficiently dense with regard to the local variation you are attempting to simulate. If the sampling of input points is sparse or uneven, the results may not sufficiently represent the desired surface (Watson and Philip, 1985).

• The characteristics of the interpolated surface can also be controlled by limiting the input points used in the calculation of each output cell value. The input can be limited by the number of sample points to be used (VARIABLE) or by a radius within which there are points to be used (FIXED). When using the VARIABLE search method:

• If there are not enough points within the maximum_distance search radius to meet the number_of_points criteria, then only those points within the maximum_distance are used.
• If no points are found within the maximum_distance, then NoData is assigned to the cell.
When using the FIXED search method:
• If the minimum_number_of_ points = 0 and no points are found within the specified distance, then NODATA is assigned to the cell.
• If a minimum_number_of_points value greater than 0 is specified, and either no points are found or the required number of points are not not found, the search radius will be increased until the required nunber of points is satisified.
• Note: When the search radius needs to be increased it is done so until the minimum_number_of_points fall within that radius, or the extent of the radius crosses the lower (southern) and/or upper (northern) extent of the output raster. NoData is assigned to all locations that do not satisfy the above condition.
• Note: If the distance is increased, then there may suddenly be more than minimum_number_of_points within the search radius. This is because some points that are equidistant from the location at which the estimate is required are now included in the search radius.

• Some input datasets may have several points with the same X,Y coordinates. If the values of the points at the common location are the same, they are considered duplicates and have no affect on the output. If the values are different, they are considered 'coincident' points. Interpolation functions may handle this data condition differently, in some cases using the first coincident point encountered for the calculation, or sometimes the last. For IDW, the values will be averaged.

This may cause some locations in the output raster to have different values than what you might expect. The solution is to prepare your data by removing these coincident points.

• The barriers option is used to specify the location of linear features known to interrupt the surface continuity. These features do not have z-values. Cliffs, faults, and embankments are typical examples of barriers. Barriers limit the selected set of the input sample points used to interpolate output z-values to those samples on the same side of the barrier as the current processing cell. Separation by a barrier is determined by line-of-sight analysis between each pair of points. This means that topological separation is not required for two points to be excluded from each other's region of influence. Input sample points that lie exactly on the barrier line will be included in the selected sample set for both sides of the barrier.

• Barrier features are input as polyline features. IDW only uses the x,y coordinates for the linear feature; therefore, it is not necessary to provide z-values for the left and right sides of the barrier. Any z-values provided will be ignored.

• Using barriers will significantly extend the processing time.

• This tool has a limit of approximately 45 million input points. If your input feature class contains more than 45 million points, the tool may fail to create a result. You can avoid this limit by interpolating your study area in several pieces, making sure there is some overlap in the edges, and then mosaicking the results to create a single large raster dataset. Alternatively you can use a Terrain geodatabase to store and visualize points and surfaces comprised of billions of measurement points.

• The input feature data must contain at least one valid field.

• The following environment settings affect this tool:

• Map Algebra

• The output value for a cell using IDW is limited to the range of the values used to interpolate. Because IDW is a weighted distance average, the average cannot be greater than the highest or less than the lowest input. Therefore, it cannot create ridges or valleys if these extremes have not already been sampled (Watson and Philip, 1985).

• The best results from IDW are obtained when sampling is sufficiently dense with regard to the local variation you are attempting to simulate. If the sampling of input points is sparse or uneven, the results may not sufficiently represent the desired surface (Watson and Philip, 1985).

• The influence of an input point on an interpolated value is isotropic. Since the influence of an input point on an interpolated value is distance related, IDW is not "ridge preserving" (Philip and Watson, 1982).

• Some input datasets may have several points with the same X,Y coordinates. If the values of the points at the common location are the same, they are considered duplicates and have no affect on the output. If the values are different, they are considered 'coincident' points. Interpolation functions may handle this data condition differently, in some cases using the first coincident point encountered for the calculation, or sometimes the last. For IDW, the values will be averaged.

This may cause some locations in the output raster to have different values than what you might expect. The solution is to prepare your data by removing these coincident points.

• GENERATE input files in the POINT format provide an easy method to create surfaces and two-dimensional coverages from ASCII files containing x,y coordinates and z-values. The x,y coordinates and z-values can be expressed as integers or single- or double-precision floating-point values. The x,y coordinates for the output raster are stored in DOUBLE precision. The z-values are stored in SINGLE precision. GENERATE files in the POINT format contain the feature ID, x,y coordinates, and z-values for point features. The ID values are not used by IDW. The format for GENERATE files containing points is:

```     ID,X,Y,Z
...
END```

The end of the file is indicated with the END keyword.

• A typical GENERATE file containing points is shown below. The file can be comma or space delimited.

```     1,234.065,837.123,125.845
2,735.774,729.345,93.739
37,840.934,385.700,157.037
5,385.888,286.602,25.764
END```

• The barriers option is used to specify the location of linear features known to interrupt the surface continuity. These features do not have z-values. Cliffs, faults, and embankments are typical examples of barriers. Barriers limit the selected set of the input sample points used to interpolate output z-values to those samples on the same side of the barrier as the current processing cell. Separation by a barrier is determined by line-of-sight analysis between each pair of points. This means that topological separation is not required for two points to be excluded from each other's region of influence. Input sample points that lie exactly on the barrier line will be included in the selected sample set for both sides of the barrier.

• The barriers option will significantly extend the processing time.

• Barrier features can be input as either a coverage or a GENERATE file in the LINE format. IDW will look for the {barriers} coverage first, and if not found, it will look for the {barrier} file. IDW only uses the x,y coordinates for the linear feature; therefore, it is not necessary to provide z-values for the left and right sides of the barrier. Any z-values provided will be ignored.

LINE input files contain the feature ID, followed by the x,y coordinates for each vertex in the file. Each line feature must have at least two, and no more than 20,000, vertices. The general LINE input file format is:

`     ID X,Y,(Z) ... X,Y,(Z) END END`

The end of each line is indicated with the END keyword, and the end of the file is indicated with a second END keyword.

The following is an example of a 3D GENERATE file in the LINE format. In this case, only the x,y coordinates are used by IDW. The feature IDs and z-values are ignored.

```     2
345321.5  678543.1  123
345879.0  689231.2  145
345999.9  690579.3  157
END
2
367809.0  712004.0  209
368098.9  710776.8  214
369890.6  709768.2  206
370023.4  716098.3  198
END
2
390879.0  602090.0  133
391000.6  606668.2  169
397547.3  609608.4  125
END
END```

• IDW does not respect the Mask setting.

• Learn more about how to specify the input feature dataset in the Map Algebra expression of Raster Calculator.

• ArcObjects

• The output value for a cell using IDW is limited to the range of the values used to interpolate. Because IDW is a weighted distance average, the average cannot be greater than the highest or less than the lowest input. Therefore, it cannot create ridges or valleys if these extremes have not already been sampled (Watson and Philip, 1985).

• The best results from IDW are obtained when sampling is sufficiently dense with regard to the local variation you are attempting to simulate. If the sampling of input points is sparse or uneven, the results may not sufficiently represent the desired surface (Watson and Philip, 1985).

• The influence of an input point on an interpolated value is isotropic. Since the influence of an input point on an interpolated value is distance related, IDW is not "ridge preserving" (Philip and Watson, 1982).

• Some input datasets may have several points with the same X,Y coordinates. If the values of the points at the common location are the same, they are considered duplicates and have no affect on the output. If the values are different, they are considered 'coincident' points. Interpolation functions may handle this data condition differently, in some cases using the first coincident point encountered for the calculation, or sometimes the last. For IDW, the values will be averaged.

This may cause some locations in the output raster to have different values than what you might expect. The solution is to prepare your data by removing these coincident points.

• The barrier option is used to specify the location of linear features known to interrupt the surface continuity. These features do not have z-values. Cliffs, faults, and embankments are typical examples of barriers. Barriers limit the selected set of the input sample points used to interpolate output z-values to those samples on the same side of the barrier as the current processing cell. Separation by a barrier is determined by line-of-sight analysis between each pair of points. This means that topological separation is not required for two points to be excluded from each other's region of influence. Input sample points that lie exactly on the barrier line will be included in the selected sample set for both sides of the barrier.

• Barrier features are represented by a shapefile containing arcs. IDW only uses the x,y coordinates for the linear feature; therefore, it is not necessary to provide z-values for the left and right sides of the barrier.

• Using barriers will significantly extend the processing time.

• A FeatureDescriptor is needed in ArcObjects to specify the field to be used in the interpolation. The following is an example:

```     Dim pFDesc As IFeatureClassDescriptor
Set pFDesc = New FeatureClassDescriptor
PFDesc.Create pInputDataset, Nothing, "Value"
'Value is the field name used for interpolation```

• When the selected field is FID in the FeatureClassDescriptor object, the SPOT field will be used. If no SPOT field is present, NONE is used.

• The SPOT item will be used from the input feature class object. If another item is desired, then that item must be specified in a FeatureClassDescriptor.

• As with the Raster Calculator, when using the IDW method in ArcObjects, the output cell size must be defined in the raster environment. The following is an example of setting it:

```     Dim pEnv As IRasterAnalysisEnvironment
Set pEnv = pInterpolationOp
pEnv.SetCellSize esriRasterEnvValue, 50```

• This tool has a limit of approximately 45 million input points. If your input feature class contains more than 45 million points, the tool may fail to create a result. You can avoid this limit by interpolating your study area in several pieces, making sure there is some overlap in the edges, and then mosaicking the results to create a single large raster dataset. Alternatively you can use a Terrain geodatabase to store and visualize points and surfaces comprised of billions of measurement points.

Command line syntax
An overview of the Command Line window
Idw_sa <in_point_features> <z_field> <out_raster> {cell_size} {power} {search_radius} {in_barrier_polyline_features}

 Parameter Explanation Data Type The input point features containing the z-values to be interpolated into a surface raster. Composite Geodataset Field that holds a height or magnitude value for each point. This can be a numeric field or the Shape field if the in_point_features contains z-values. Field The output raster surface to be created. Raster Dataset {cell_size} 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 {power} The exponent of distance. Controls the significance of surrounding points on the interpolated value. A higher power results in less influence from distant points. It can be any real number greater than zero, but the most reasonable results will be obtained using values from 0.5 to 3. The default is 2. Double {search_radius} Defines which of the input points will be used to interpolate the value for each cell in the output raster. There are two options: VARIABLE and FIXED. Variable is the default. VARIABLE {number_of_points} {maximum_distance} Uses a variable search radius in order to find a specified number of input sample points for the interpolation. {number_of_points}  — An integer value specifying the number of nearest input sample points to be used to perform interpolation. The default is 12 points. {maximum_distance}  — Specifies the distance, in map units, by which to limit the search for the nearest input sample points. The default value for maximum_distance is the length of the extent's diagonal. FIXED {distance} {minimum_number_of_points} Uses a specified fixed distance within which all input points will be used for the interpolation. {distance}  — Specifies the distance as a radius within which input sample points will be used to perform the interplation. The value of the radius is expressed in map units. The default radius is five times the cell size of the output raster.{minimum_number_of_points}  — An integer defining the minimum number of points to be used for interpolation. The default value is zero (0). Radius {in_barrier_polyline_features} Polyline features to be used as a break or limit in searching for the input sample points. Composite Geodataset
Data types for geoprocessing tool parameters

### Command line example

`Idw_sa c:/data/pts.shp spot final_1 1 2 "VARIABLE 12"`

Scripting syntax
About getting started with writing geoprocessing scripts
Idw_sa (in_point_features, z_field, out_raster, cell_size, power, search_radius, in_barrier_polyline_features)

 Parameter Explanation Data Type in_point_features (Required) The input point features containing the z-values to be interpolated into a surface raster. Composite Geodataset z_field (Required) Field that holds a height or magnitude value for each point. This can be a numeric field or the Shape field if the in_point_features contains z-values. Field out_raster (Required) The output raster surface to be created. Raster Dataset 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 power (Optional) The exponent of distance. Controls the significance of surrounding points on the interpolated value. A higher power results in less influence from distant points. It can be any real number greater than zero, but the most reasonable results will be obtained using values from 0.5 to 3. The default is 2. Double search_radius (Optional) Defines which of the input points will be used to interpolate the value for each cell in the output raster. There are two options: VARIABLE and FIXED. Variable is the default. VARIABLE {number_of_points} {maximum_distance} Uses a variable search radius in order to find a specified number of input sample points for the interpolation. {number_of_points}  — An integer value specifying the number of nearest input sample points to be used to perform interpolation. The default is 12 points. {maximum_distance}  — Specifies the distance, in map units, by which to limit the search for the nearest input sample points. The default value for maximum_distance is the length of the extent's diagonal. FIXED {distance} {minimum_number_of_points} Uses a specified fixed distance within which all input points will be used for the interpolation. {distance}  — Specifies the distance as a radius within which input sample points will be used to perform the interplation. The value of the radius is expressed in map units. The default radius is five times the cell size of the output raster.{minimum_number_of_points}  — An integer defining the minimum number of points to be used for interpolation. The default value is zero (0). Radius in_barrier_polyline_features (Optional) Polyline features to be used as a break or limit in searching for the input sample points. Composite Geodataset

Data types for geoprocessing tool parameters

### Script example

```# IDW_sample.py
# Description:
#   Interpolate a series of point features onto a rectangular
#   raster using Inverse Distance Weighting (IDW).
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
# Set the output workspace name
gp.Workspace = "c:/data"

# Set the input feature dataset
inputFeatureDataset = "c:/data/pts.shp"

# Set the output raster name
outputRaster = "final_1"

# Set some of the IDW parameters
cell_size = 1
IDW_power = 2
IDW_neighborhood = "VARIABLE 12"
Input_barrier_polyline_features = ""          # None

# Set the output extent
gp.Extent = "0 0 6 6"

# Set the attribute field
attributeName = "spot"

# Check out Spatial Analyst extension license
gp.CheckOutExtension("Spatial")

# Process: IDW
gp.Idw_sa(inputFeatureDataset, attributeName, outputRaster, cell_size, _
IDW_power, IDW_neighborhood, Input_barrier_polyline_features)

except:
# If an error occurred while running a tool, then print the messages
print gp.GetMessages()
```

Map Algebra syntax
Idw(<point_feature | point_file>, {spot_item}, {barriers}, {power}, {SAMPLE, {num_points}, {max_radius}}, {cellsize}, {xmin, ymin, xmax, ymax})

Idw(<point_feature | point_file>, {spot_item}, {barriers}, {power}, {RADIUS, {radius}, {min_points}}, {cellsize},{xmin, ymin, xmax, ymax})

 Parameter Explanation The source of the data containing points with z-values to be converted to a raster surface. point_feature  — A point shapefile or coverage with z-values stored in an item. point_file  — An ASCII GENERATE file in the POINT format. {spot_item} The item in the point shapefile or coverage to be used as the z-value for the interpolation. The default is an item named SPOT. Use the # symbol as a placeholder when the point locations are input using a . If the default SPOT item is not present, specify an alternative item. {barriers} A shapefile or coverage containing arcs or an ASCII file of lines to be used as a break or limit in searching for the input sample points. {power} Exponent of distance. Controls the significance of surrounding points upon the interpolated value. A higher power results in less influence from distant points. It can be any real number greater than zero, but the most reasonable results will be obtained using values from 0.5 to 3. The default is 2. SAMPLE Keyword indicating the method of searching for input points. {num_points} An integer value specifying the number of nearest input sample points to be used to perform interpolation. The default is 12 points. {max_radius} Specifies the distance, in map units, by which to limit the search for the nearest input sample points. If the number of points for the SAMPLE option cannot be satisfied within the {max_radius}, a smaller number of points will be used. RADIUS Keyword indicating the method of searching for input points. {radius} The distance, in map units, specifying that all input sample points within the specified radius will be used to perform interpolation. The default radius is five times the cell size of the output raster. {min_points} An integer value defining the minimum number of points to be used for interpolation. If the required number of points is not found within the specified radius, the search radius will be increased until the specified minimum number of points is found. The default is zero. {cellsize} The width or height of a cell in map units. The cell size defaults to the current environment setting. If the cell size is not set, an error message will appear. In this case, specify the {cellsize} argument or use the Options dialog box to establish the current environment setting. {xmin, ymin, xmax, ymax} The window in which to perform the interpolation. Defaults to the current environment settings. If no environment is set, the default is the boundary of the input extended 0.5 times the cell size in each direction.

### Map Algebra example

```idw(pointcov)
idw(ptcover, depth, #, 1, sample, 10)
idw(pntfile, #, faultcov, #, radius, 500, 30)
idw(wellcover, flowrate, linefile, 3, sample, 20, #, 1.5, 34934, 89342, 35468, 93457)
idw(popdense, density, shores, #, radius, 30)	```

ArcObjects syntax
IInterpolationOp::IDW (geoData As IGeoDataset, power As Double, radius as IRasterRadius, [barrier As Variant]) As IGeoDataset

 Parameter Explanation geoDataset A Featureclass or FeatureclassDescriptor containing point features with z-values to be interpolated to a raster surface. power Exponent of distance. Controls the significance of surrounding points on the interpolated value. A higher power results in less influence from distant points. It can be any real number greater than zero but the most reasonable results will be obtained using values from 0.5 to 3. A commonly used power is 2. radius An IRasterRadius indicating the search radius for the input points. The radius distance is specified in map units within which all input sample points will be used to perform interpolation. A commonly used radius is five times the cell size of the output raster. The object will set and use whatever you set last in your VB script. For example: ``` set pRad.SetFixed 207.1 set pRad.SetVariable 12 will use the args "... ,SAMPLE,12, ....", while: set pRad.SetVariable 12 set pRad.SetFixed 207.1 will use the args "... ,RADIUS,207.1, ....".``` [barrier] A shapefile containing arcs to be used as a break or limit in searching for the input sample points.

### ArcObjects example

```' Create the RasterInterpolationOp object
Dim pInterpolationOp As IInterpolationOp
Set pInterpolationOp = New RasterInterpolationOp

' Create the input point object
Dim pInputDataset As IGeoDataset

' Calls function to open the point dataset from disk
Set pInputDataset = OpenFeatureDataset("D:\SpatialData", "inputpoints")