The Optimal Path As Raster tool determines the optimal raster path from destinations to sources.
This tool is now available in Map Viewer, the modern map-making tool in ArcGIS Online. To learn more, see Optimal Path as Raster (Map Viewer).
If you do not see this tool in Map Viewer Classic, contact your organization administrator. You may not have image analysis privileges, available with the ArcGIS Image for ArcGIS Online license.
Example applications include the following:
- Find the optimal route for a new road.
- Find the downstream trace from a location.
Before generating an optimal path, usually one of the following tools is used to create a distance accumulation raster and a back direction raster: Distance Accumulation or Distance Allocation. These are required inputs to generate an optimal path.
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 Input back direction 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. The Flow Direction raster function can be used to generate the D8 flow direction raster.
When the input destination data is a raster, the set of destination cells consists of all cells in the Input raster or feature destination data that have valid values. Cells that have NoData values are not included in the source set. The value zero is considered a legitimate destination.
When using feature data for the input destinations, care must be taken with how the output cell size is managed, particularly when it is coarse relative to the detail present in the input. An internal rasterization process using the Feature to Raster tool is applied. This means that data that is not located at the center of the cell will not be included in the intermediate rasterized destination output, and will not be represented in the distance calculations. For example, if your destinations are a series of small polygons, such as building footprints, that are small relative to the output cell size, it is possible that only a few of them will fall under the centers of the output raster cells, seemingly causing many of the others to be lost in the analysis.
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 destination and then converging to the same source. 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.
To generate an optimal path, the Extent, Cell size, and Snap Raster environment settings are ignored and the characteristics of the back direction raster are used to calculate the output raster. The pattern of the back direction raster would be seriously altered if it were resampled or snapped, or if the extent was altered.
The parameters for this tool are listed in the following table:
|Choose destination raster or features|
A raster or feature input identifying the cells from which the optimal path is determined to the optimum source.
If the input is a raster, it must consist of cells that have valid values (zero is a valid value) for the destinations, and the remaining cells must be assigned NoData. The input raster type must be integer.
The field that will be used to obtain values for the destination locations.
|Choose distance accumulation raster|
The distance accumulation raster that will be used to determine the optimal path from the destinations to the sources.
The distance accumulation raster is usually created with the Distance Accumulation or Distance Allocation tool. 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.
|Choose back direction or flow direction raster|
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 back direction raster is usually created with the Distance Accumulation or Distance Allocation tools. In this case the range of values is from 0 degrees to 360 degrees. The value 0 is reserved for the source cells. Due east (right) is 90 degrees, and the values increase clockwise (180 is south, 270 is west, and 360 is north).
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 this parameter.
|Path type (optional)|
Specifies a keyword that defines how the values and zones in the input destination data will be interpreted in the cost path calculations.
|Result layer name|
You can specify the name of a folder in My Content where the result will be saved using the Save result in drop-down box. If you have privileges to create both tiled and dynamic imagery layers, you can also specify which layer type you want to use for the output using the Save result as drop-down box.
Click Show Credits before you run your analysis to check how many credits will be consumed.
Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings by clicking the gear icon at the top of the tool pane.
This tool honors the following Analysis Environments:
- Output coordinate system—Specifies the coordinate system of the output layer.
Similar tools and raster functions
The Optimal Path As Raster tool determines the optimal raster path from destinations to sources. Other tools may be useful in solving similar problems.
Map Viewer Classic analysis tools and raster functions
Use the Optimal Path As Line tool to calculate the optimal paths and create a feature service output.
Optimal Path As Raster is available as a raster function.
ArcGIS Pro analysis tools and raster functions
Optimal Path As Raster is available as a raster function.