Skip To Content

Least Cost Path function

Available with Spatial Analyst license.

Overview

Calculates the least-cost path from a source to a destination. The least accumulative cost distance is calculated for each pixel over a cost surface, to the nearest source. This produces an output raster that records the least-cost path, or paths, from selected locations to the closest source pixels defined within the accumulative cost surface, in terms of cost distance.

Each least-cost path is assigned a value when encountered in the scanning process. The ending pixel on the Source Raster of a cost path receives a value of 1. The first path receives a value of 3, the second 4, and so on. 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 a value of 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.

Learn more about Creating the least cost path.

Notes

The Source Raster must be a raster. If your source is a feature class, you will need to convert it to a raster before you can use it as an input. The NoData values that exist in the Source Raster are not included as valid values in the function. The value 0 is considered a legitimate value in the source raster. A Source Raster can be created using the extraction tools or the Clip function.

Pixel values of NoData in the Cost Raster act as barriers in the cost surface. Any pixels that are assigned a value of NoData in the Cost Raster will also have a value of NoData in the output raster. The Cost Raster cannot contain a value of 0 since the algorithm is a multiplicative process. If values of 0 actually represent areas of low cost, change the value of 0 to a small positive value such as 0.01 using the Con function. If the value of 0 represent areas that should be excluded from the analysis, these values should be turned into NoData using the Set Null function.

If the Source Raster and the Cost Raster have different extents, the default output extent is the intersection of the two rasters. If you want a cost distance surface output of the entire extent, choose the Union of Inputs option on the Output Extent geoprocessing Environments.

The Maximum Distance is specified in the same cost units as the Cost Raster.

The characteristics of the source, or the movers from a source, can be controlled by the following parameters:

  • Multiplier to Apply to Costs—The mode of travel or magnitude at the source
  • Start Cost—The starting cost before the movement begins
  • Accumulative Cost Resistance Rate—A dynamic adjustment accounting for the impact of accumulated cost, for example, simulating how much a hiker is becoming fatigued
  • Capacity—The cost a source can assimilate before reaching its limit

If any of the source characteristics' parameters are specified using a value, that value is applied to all of the sources. If the parameters are specified through fields associated with the Source Raster, the values in the table will be uniquely applied to the corresponding sources.

If the Mask has been set in the geoprocessing environments, all masked cells will be treated as NoData values. When a mask is defined in the Raster Analysis window and the pixels to be masked will mask a source, the calculations will occur on the remaining source pixels. The source pixels that are masked will not be considered in the computations. These pixel locations will be assigned NoData in the output raster. See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this function.

Parameters

Parameter nameDescription

Source Raster

(Required)

The input raster that identifies the pixels or locations to which the least accumulated cost distance for every output pixel location is calculated. The Source Raster can be an integer or a floating point value.

Destination Raster

(Required)

A raster dataset that identifies the pixels from which the least-cost path is determined to the least costly source. This input consists of pixels that have valid values, and the remaining pixels must be assigned NoData. Values of 0 are valid.

Destination Field

The field used to obtain values for the destination locations.

Cost Raster

(Required)

A raster defining the cost or impedance to move planimetrically through each pixel. The value at each pixel location represents the cost-per-unit distance for moving through it. Each pixel location value is multiplied by the pixel resolution, while also compensating for diagonal movement to obtain the total cost of passing through the pixel.

The values of the Cost Raster can be integer or floating point, but they cannot be negative or zero.

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:

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

Maximum Distance

The threshold that the accumulative cost values cannot exceed. If an accumulative cost distance exceeds this value, the output value for the pixel location will be NoData. The maximum distance defines the extent for which the accumulative cost distances are calculated. The default distance is to the extent of the output raster.

Multiplier to Apply to Costs

This parameter allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell.

The default value is 1. The values must be greater than 0. A numeric (double) value or a field from the Source Raster can be used for this parameter.

Start Cost

The starting cost from which to begin the cost calculations. This parameter allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of 0, the cost algorithm will begin with the value specified.

The default is 0. The value must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

Accumulative Cost Resistance Rate

This parameter simulates the increase in the effort to overcome costs as the accumulative cost increases. It is used to model fatigue of the traveler. The growing accumulative cost to reach a pixel is multiplied by the resistance rate and added to the cost to move into the subsequent pixel.

It is a modified version of a compound interest rate formula that is used to calculate the apparent cost of moving through a pixel. As the value of the resistance rate increases, it increases the cost of the pixels that are visited later. The greater the resistance rate, the higher the cost to reach the next pixel, which is compounded for each subsequent movement. Since the resistance rate is similar to a compound rate and generally the accumulative cost values are very large, small resistance rates are suggested, such as 0.005 or even smaller, depending on the accumulative cost values.

The default is 0. The values must be 0 or greater. A numeric (double) value or a field from the Source Raster can be used for this parameter.

Capacity

Defines the cost capacity for the traveler for a source. The cost calculations continue for each source until the specified capacity is reached.

The default capacity is to the extent of the output raster. The values must be greater than 0. A double numeric value or a field from the Source Raster can be used for this parameter.

Travel Direction

Defines the direction of the traveler when applying the source resistance rate and the source starting cost.

  • From Source—The source resistance rate and source starting cost will be applied beginning at the input source and moving out to the nonsource cells. This is the default.
  • To Source—The source resistance rate and source starting cost will be applied beginning at each nonsource cell and moving back to the input source.

Either specify the From Source or To Source keyword, which will be applied to all sources, or specify a field in the Source Raster that contains the keywords to identify the direction of travel for each source. That field must contain the string From Source or To Source.

Environment settings

Geoprocessing Environment settings for global functions are controlled at the application level. Setting processing environments in ArcGIS Pro can be done by selecting the Environments button on the Analysis tab. See Analysis environments and Spatial Analyst for additional details on environment settings.

The following environments are supported by this global function: