ArcObjects Library Reference (SpatialAnalyst)  

IDistanceOp.CostPath Method

Calculates the least-cost path(s) from selected cell(s) in the input data to the closest source cell.

[Visual Basic .NET]
Public Function CostPath ( _
    ByVal fromData As IGeoDataset, _
    ByVal distance As IGeoDataset, _
    ByVal backlink As IGeoDataset, _
    ByVal pathType As esriGeoAnalysisPathEnum _
) As IGeoDataset
[C#]
public IGeoDataset CostPath (
    IGeoDataset fromData,
    IGeoDataset distance,
    IGeoDataset backlink,
    esriGeoAnalysisPathEnum pathType
);
[C++]
HRESULT CostPath(
  IGeoDataset* fromData,
  IGeoDataset* distance,
  IGeoDataset* backlink,
  esriGeoAnalysisPathEnum pathType,
  IGeoDataset** CostPath
);
[C++]

Parameters

fromData [in]

  fromData is a parameter of type IGeoDataset

distance [in]

  distance is a parameter of type IGeoDataset

backlink [in]

  backlink is a parameter of type IGeoDataset

pathType [in]

  pathType is a parameter of type esriGeoAnalysisPathEnum

CostPath [out, retval]

  CostPath is a parameter of type IGeoDataset

Product Availability

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

Remarks

fromData

an input Raster, RasterDataset, RasterBand, or RasterDescriptor or FeatureClass, FeatureClassDescriptor that identifies those cells or locations from which the least cost path is determined to the least costly source

The Raster consists of cells which are to be considered in the IDistance::CostPath method calculations having valid values ('0' is a valid value), and the remaining cells must be assigned to NoData

distance

the name of a cost distance Raster to be used to determine the least cost path from the fromRaster cell locations to a source

The distance Raster is usually created with the IDistanceOp::CostDistance method (or by the IDistanceOp::CostDistanceFull method). The distance Raster stores, for each cell, the minimum accumulative cost distance over a cost surface from each cell to a set of source cells.

backlink

the name of a cost back link Raster used to determine the path to return to a source via the least-cost path

For each cell in the back link raster, a value identifies the neighbor that is the next cell on the least accumulative cost path from the cell to a single or set of source cells.

pathType

a parameter defining the manner in which the values and zones on the fromData will be interpreted in the cost path calculations

There are three different esriGeoAnalysisPathEnum types:

esriGeoAnalysisPathForEachCell

For each cell with valid values on the fromData, a least-cost path is determined and saved on the output raster of the IDistance::CostPath method. With the for each cell parameter, each cell of the fromData input is treated separately, and a least-cost path is determined for each 'from' cell.

esriGeoAnalysisPathForEachZone

For each zone on the fromData, a single least-cost path is determined and saved on the output raster of the IDistance::CostPath method. With the for each zone parameter, for each zone, the least-cost path begins from the cell with the lowest cost distance weighting in the zone.

esriGeoAnalysisPathForBestSingle

For all cells on the fromData input, the least cost path is derived from the cell with the minimum of the least cost paths to source cells.

 

See Also

IDistanceOp Interface