This document is archived and information here might be outdated.  Recommended version.


IDistanceOp.CostDistance Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (SpatialAnalyst)  

IDistanceOp.CostDistance Method

Calculates for each cell the least-accumulative-cost distance over a cost surface to a source cell or a set of source cells.

[Visual Basic .NET]
Public Function CostDistance ( _
    ByVal sourceData As IGeoDataset, _
    ByVal costRaster As IGeoDataset, _
    [ByRef maxDistance As Object], _
    [ByRef valueRaster As Object] _
) As IGeoDataset
[C#]
public IGeoDataset CostDistance (
    IGeoDataset sourceData,
    IGeoDataset costRaster,
    ref object maxDistance,
    ref object valueRaster
);
[C#]

Optional Values

maxDistance   To indicate that this parameter is undefined, first define a variable object Missing=Type.Missing; then pass this in as ref Missing.
valueRaster   To indicate that this parameter is undefined, first define a variable object Missing=Type.Missing; then pass this in as ref Missing.
[C++]
HRESULT CostDistance(
  IGeoDataset* sourceData,
  IGeoDataset* costRaster,
  VARIANT* maxDistance,
  VARIANT* valueRaster,
  IGeoDataset** distance
);
[C++]

Parameters sourceData [in]
sourceData is a parameter of type IGeoDataset costRaster [in]
costRaster is a parameter of type IGeoDataset maxDistance [optional] maxDistance is a parameter of type VARIANT
To indicate this parameter is undefined pass a reference to a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND. valueRaster [optional] valueRaster is a parameter of type VARIANT
To indicate this parameter is undefined pass a reference to a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND. distance [out, retval]
distance is a parameter of type IGeoDataset

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Spatial Analyst Extension.

Remarks

sourceData

an input Raster, RasterDataset, RasterBand, or RasterDescriptor or FeatureClass, FeatureClassDescriptor that identifies those cells or locations to which the least accumulated cost distances for every cell is calculated

For Rasters, the input value types can be either integer, string or floating-point type if in_raster_value is used.

costRaster

an input Raster, RasterDataset, RasterBand, or RasterDescriptor defining the impedance or cost to move planimetrically through each cell

The value at each cell location represents the cost per unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution (while also compensating for diagonal movement) to obtain the total cost of passing through the cell. The values on the costRaster can be integer or floating point, but they cannot be negative (you cannot have a negative cost).

[maxDistance]

defines the threshold that the accumulative cost values cannot exceed

If an accumulative cost distance value exceeds the maxDistance, the output value for the cell location will be NoData. The maxDistance defines the extent which the accumulative cost distances are calculated. If no maxDistance is specified the distance will be to the edge of the output raster. The data type for maxDistance can be either integer or floating point.

[valueRaster]

an optional input Raster that identifies the zone values that should be used for each cell on the sourceData

The value defined by the valueRaster for each source cell will be assigned to all cells that will be allocated to the source cell in the cost allocation computations. If no valueRaster is specified, the zone value for a source cell is the value on the sourceData.

This parameter is particularly important if the sourceRaster was created by the ILogicalOp::Test or a ILogicalOp::Boolean methods that will only output 1 and 0 or if alternative values or zones are to be used instead of the existing ones, on the input source. The data type for the valueRaster can be of type Raster, RasterDataset, RasterBand, or RasterDescriptor.

 

See Also

IDistanceOp Interface

.NET Snippets

Create DistanceOp Cost Distance Raster