The Optimal Path as Raster tool determines the optimal raster path from destinations to sources.
The output is a hosted imagery layer.
Learn how Optimal Path as Raster works
Examples
Example applications include the following:
Find the optimal route for a new road.
Find the downstream trace from a location.
Usage notes
Optimal Path as Raster includes configurations for input layers, path settings, and the result layer.
Input layers
The Input layers group includes the following parameters:
Input destination raster or features is an integer raster or feature layer that identifies the destination from which the distance is calculated to the least costly source.
You can choose a layer using the Layer button, or you can create a sketch layer to use as the input using the Draw input features button. For feature inputs, a count of features is displayed below the layer name. The count includes all features in the layer, except features that have been removed using a filter. Environment settings, such as Processing extent, are not reflected in the feature count.
If a destination falls on NoData in any of the corresponding input rasters, it is ignored in the analysis, and no path from this destination will be calculated.
If the input is a raster, it must consist of cells that have valid values (zero is a valid value) for the destination, and the remaining cells must be assigned NoData.
If the input is a feature layer, it can be point, line, or polygon.
When the input destination data is a feature, the source locations are converted internally to a raster before performing the analysis.
To generate an optimal path, the Cell size environment setting is ignored and the cell size of the Input back direction raster value is used to calculate the output raster. The pattern of the back link raster will be altered if it is resampled to a different resolution. To avoid confusion, do not set the cell size when using this tool.
When using polygon feature data for the input feature destinations, care must be taken with how the output cell size is handled, particularly when it is coarse relative to the detail present in the input. An internal rasterization process using the Polygon to Raster tool is applied, with a default setting for Cell assignment type of Cell center. 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 the 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.
To avoid this situation, as an intermediate step, you can rasterize the input features directly using the Convert Feature to Raster tool and set the Value Field parameter. Then use the resulting output as input to the distance tool you want to use.
Before generating an optimal path, one of the following tools is typically 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 Input back direction raster or a flow direction raster. Also supply an Input distance accumulation raster value. If the Create network paths parameter is not available, the Input distance accumulation raster value is not used to determine the path. Whether you use a constant raster or a digital elevation model (DEM), the path will be the same; only an attribute value on the path will vary. However, if Create network paths is available and used, the Input distance accumulation raster value must be an Output flow accumulation raster value. See the Flow Direction tool documentation for more information about D8 flow direction rasters and the Flow Accumulation tool documentation to create the accumulation raster.
Destination field is an integer field that will be used to obtain values for the destination locations.
Input distance accumulation raster is used to determine the optimal path from the sources to the destinations
The distance accumulation raster is typically 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.
Input 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 to 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 settings
The Path settings group includes Path type, which defines how the values and zones on the input destination data will be interpreted in the cost path calculations. Path type has the following options:
Each zone—For each zone on the input destination data, a least-cost path will be 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. This is the default.
Best single—For all cells on the input destination data, the least-cost path will be 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, a least-cost path will be 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.
Result layer
The Result layer group includes the following parameters:
Output raster name is the name of the layer that will be created and added.
The name must be unique. If a layer with the same name already exists in your organization, the tool will fail and you will be prompted to use a different name.
- Output layer type specifies the type of raster output that will be created. The output can be either a tiled imagery layer or a dynamic imagery layer.
- Save in folder specifies the name of a folder in My content where the result will be saved.
Limitation
The Draw input features button is not available in Scene Viewer.
Environments
This tool does not honor any environment settings.
Credits
This tool consumes credits.
Use Estimate credits to calculate the number of credits that will be required to run the tool. For more information, see Understand credits for spatial analysis.
Outputs
This tool produces a hosted raster consisting of optimal paths as output.
The values on the output optimal path represent the number of paths at a location. In many cases, paths follow the same route, leaving the location and diverging to go to different destinations. For example, a value of 1 indicates that there is one optimal path at a location, while a value of 5 indicates that there are five optimal paths at that location going through that cell in the study area.
Usage requirements
This tool requires the following user type and configurations:
- Professional or Professional Plus user type
- Publisher, Facilitator, or Administrator role, or an equivalent custom role with the Imagery Analysis privilege
Resources
Use the following resources to learn more:
- How Optimal Path as Raster works
- Optimal Path As Raster in ArcGIS REST API
- optimal_path_as_raster in ArcGIS API for Python
- Optimal Path As Raster in ArcGIS Pro with the Raster Analysis extension
- Optimal Path As Raster in ArcGIS Pro with the Spatial Analyst extension