# Creating the least-cost path

## What is the least-cost path?

The Cost Path tool determines the least-cost path from a destination point to a source. Aside from requiring that the destination be specified, the Cost Path tool uses two rasters derived from a cost distance tool: the least-cost distance raster and the back-link raster. These rasters are created from the Cost Distance or Path Distance tools. The backlink raster is used to retrace the least costly route from the destination to the source over the cost distance surface.

## Why find the least-cost path?

The least-cost path travels from the destination to the source. This path is one cell wide, travels from the destination to the source, and is guaranteed to be the cheapest route relative to the cost units defined by the original cost raster that was input into the weighted-distance tool. Use the Cost Path tool to find the best route for a new road in terms of construction costs or to identify the path to take from several suburban locations (sources) to the closest shopping mall (destination). When applying the tool to a road construction example, the resulting path is the cheapest route for constructing a road from the destination to the source (the existing intersection).

You can see two potential paths for the new road in the diagram above (in purple and red). The purple line represents the path created using a cost raster in which each input raster (land use and slope) had the same influence. The red line represents the path created using a cost raster in which the slope input raster had a weight (influence) of 66 percent. By giving the slope input raster a higher weight, more attention was given to avoiding steeper slopes in the red path.

## Creating the least-cost path

It is important to consider how to weight the rasters that make up the cost raster. How you weight your raster depends on your application and the results you want to achieve.

If there are multiple cells or zones as input destinations, the least-cost path can be calculated from each cell (resulting in multiple paths, one path for each cell), each zone (one path from each zone), or by best single path (only one path, the cheapest from any zone). A parameter in the tool specifies which process should be utilized.

In the following examples, the Cost Path will be demonstrated using different Path type options.

## Examples

To illustrate the outcomes of the different cost path options, consider the following example of source and target locations.

### Each zone

With the Each zone option, there will be a different path generated for each of the From target locations.

### Single path

In the following example, Cost Path will be demonstrated using the best Single path option. When there is a single least-cost path, it will be coded to the value 3 on the output raster. The cell within the source zone where the path originates is assigned the value 1.