# Optimal Path As Raster function

## Overview

Calculates the optimal path from destinations to sources.

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

This is a global raster function.

## Notes

The results from the Distance Accumulation function are generally required to run the Optimal Path As Raster function. Running the Distance Accumulation function allows you to create the distance accumulation Rraster and back direction raster, which are required input raster layers to the Optimal Path As Raster function.

The optimal path created can be a flow path based on D8 flow direction. To generate an optimal path in this way, use a D8 flow direction raster as input for the back direction raster or flow direction raster. You also need to supply an input distance accumulation raster; the input distance accumulation raster is not used to determine the path. Whether you use a constant raster or a digital elevation model (DEM), your path will be the same; only an attribute value on your path will vary. See the Flow Direction function for more information on D8 flow direction rasters.

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 distance accumulation or back direction raster as the raster input to the rasterization function. This will ensure that the feature is rasterized using the same cell size, extent, and spatial reference as the other rasters going into the Optimal Path As Raster function.

The values on the output optimal path represent the number of paths at a given location. In many cases, paths follow the same route, leaving a source and diverging to go to different destinations. For example, a value of one indicates that there is only one optimal path at a given location, while a value of five means at that location, there are five optimal paths going through that cell in the study area.

## Parameters

The Optimal Path As Raster function parameters are described in the following table:

ParameterDescription

Destination Raster

(Required)

An integer raster dataset layer that identifies the locations from which the optimum path is determined to be the least costly source.

The input raster layer must consist 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.

Distance Accumulation Raster

(Required)

The distance accumulation raster is used to determine the optimal path from the destinations to the sources. The distance accumulation raster is usually created with the Distance Accumulation function. Each cell in the distance accumulation raster represents the minimum accumulative cost distance over a surface from each cell to a set of source cells.

Back Direction Raster or Flow Direction Raster

(Required)

The back direction raster contains calculated directions in degrees. The direction identifies the next cell along the optimal path back to the least accumulative cost source while avoiding barriers.

The range of values is from 0 degrees through 360 degrees, with 0 reserved for the source cells. Due east (right) is 90, and the values increase clockwise (180 is south, 270 is west, and 360 is north).

Path Type

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