Skip To Content

Cost Path function

Available with Spatial Analyst license.

Overview

The Cost Path function calculates the least-cost path from a source to a destination.

This function produces an output raster that records the least-cost path or paths from selected locations to the closest source cell defined within the accumulative cost surface, in terms of cost distance

Notes

One or more of the weighted cost functions (Cost Distance, Cost Allocation or Cost Back Link) are generally required to be run prior to running the Cost Path function to create the input cost distance and back link rasters. These are mandatory input raster layers to the Cost Path function.

Each least-cost path is assigned a value when encountered in the scanning process. The ending cell on the original source raster layer (from which the cost distance and back link were derived) of a cost path receives one, the first path receives three, the second four, and so on. The value two is reserved for the merged portion of paths that have portions of a common cost path.

The input destination data must be a raster layer. The set of destination cells consists of all cells in the input raster that have valid values. Cells that have NoData values are not included in the set. The value zero is considered a legitimate destination. A destination raster can be created using the extraction tools.

If you have destination or source features, you can convert them to raster using the Rasterize Features function. Use the cost distance or cost back link raster as the Raster input to the rasterization function. This will ensure the feature is rasterized using the same cell size, extent, and spatial reference as the other rasters going into the Cost Path function.

When multiple paths merge and follow the remaining distance back to a source on the same route, the segment where the two paths travel together is assigned the value 2. The merged portion of the path cannot be assigned the value of one of the paths, since the merged portion belongs to both routes.

The Cost Path function can also be used to derive the path of least resistance down a digital elevation model (DEM). In this case, use the DEM for the input cost distance raster and the output from the Flow Direction function for the Cost Backlink Raster.

Parameters

The Cost Path function parameters are described in the following table:

ParameterDescription

Destination Raster

(Required)

A raster dataset layer that identifies those cells from which the least-cost path is determined to the least costly source.

The input raster layer consists of cells that have valid values (zero is a valid value), and the remaining cells must be assigned NoData.

Destination Field

The field used to obtain values for the destination locations. Input feature data must contain at least one valid field.

Cost Distance Raster

The name of a cost distance raster to be used to determine the least-cost path from the destination locations to a source.

The cost distance raster is usually created with the Cost Distance, Cost Allocation, or Cost Back Link function. The cost distance raster layer stores, for each cell, the minimum accumulative cost distance over a cost surface from each cell to a set of source cells.

Cost Backlink Raster

The name of a cost back link raster layer 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's the next cell on the least accumulative cost path from the cell to a single source cell or set of source cells.

Path Type

A keyword defining the manner in which the values and zones on the input destination data will be interpreted in the cost path calculations. The options are as follows:

  • Each Cell—For each cell with valid values on the input destination data, a least-cost path is determined and saved on the output raster. With this option, each cell of the input destination data is treated separately, and a least-cost path is determined for each cell.
  • Each Zone—For each zone on the input destination data, a least-cost path is determined and saved on the output raster. With this option, the least-cost path for each zone begins at the cell with the lowest cost distance weighting in the zone.
  • Best Single—For all cells on the input destination data, the least-cost path is derived from the cell with the minimum of the least-cost paths to source cells.

Related topics


In this topic
  1. Overview
  2. Notes
  3. Parameters