Optimal Path As Line (Map Viewer Classic)

Optimal Path As Line The Optimal Path As Line tool determines the optimal path as a line from destinations to sources.

Note:

This tool is now available in Map Viewer, the modern map-making tool in ArcGIS Enterprise. To learn more, see Optimal Path as Line (Map Viewer).

To run this tool, the organization must be configured for raster analytics.

If you do not see this tool in Map Viewer Classic, contact your organization administrator. Your portal may not be configured for raster analysis, or you may not have the privileges required to run the tool.

Workflow diagram

Optimal Path As Line workflow

Examples

Example applications include the following:

  • Find the best route for a new road in terms of construction costs.
  • Find the best sailing route between a destination and current location.

Usage notes

The Optimal Path As Line tool produces an output line feature service that records the optimal path, or paths, from destinations to the closest source defined within the accumulative cost surface.

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 output line feature has a field named DestID and a field named PathCost. The DestID field identifies to which destination each line leads. The PathCost field shows the total accumulative cost for each path.

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:

ParameterExplanation
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.

Destination field

The field that will be used to obtain values for the destination locations.

This field must be of type integer.

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.

  • To Each Zone—For each zone in the input destination data, a least-cost path will be determined. 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 in 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.
  • To Each Cell—For each cell with valid values in the input destination data, a least-cost path will be determined. With this option, each cell of the input destination data is treated separately, and a least-cost path is determined for each cell.

Result feature layer name

The name of the layer that will be created in My Content and added to the map. The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another 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.

Environments

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 Analysis Environments 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 Line tool determines the optimal path as a line 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 Raster tool or the Optimal Path as Raster function to calculate the optimal paths and create an image service output.

ArcGIS Pro analysis tools and raster functions

The Optimal Path As Raster and the Optimal Path As Line geoprocessing tools are available in the Spatial Analyst and Raster Analysis toolbox.

The Optimal Path As Raster and the Optimal Path As Line geoprocessing tools are available in the Raster Analysis toolbox.

Optimal Path As Raster is available as a raster function.

ArcGIS Enterprise developers resources

If you are working in the ArcGIS REST API, use the Optimal Path As Line and the Optimal Path As Raster tasks.

If you are working in ArcGIS API for Python, use optimal_path_as_line ArcGIS for Python API website from the arcgis.raster.analytics module, or use optimal_path_as_raster ArcGIS for Python API website from the arcgis.raster.functions.gbl module.