Determine Travel Cost Path As Polyline (Raster Analysis)

Summary

Calculates the least-cost polyline path between sources and destinations.

Legacy:

This tool is deprecated and will be removed in a future release.

The Distance Accumulation and Optimal Path As Line tools provide enhanced functionality or performance.

Illustration

Determine Travel Cost Path as Polyline tool illustration

Usage

  • This raster analysis portal tool is available when you are signed in to an ArcGIS Enterprise portal that has ArcGIS Image Server configured for Raster Analysis. When the tool is run, ArcGIS Pro serves as a client and the processing occurs in the servers federated with ArcGIS Enterprise. The portal tool accepts layers from your portal as input and creates output in your portal.

    The input raster layer supports a layer from the portal, a URI or URL to an image service, or the output from the Make Image Server Layer tool. The input feature layer can be a layer from the portal or a URI or URL to a feature service. This tool does not support local raster data or layers. While you can use local feature data and layers as input to this portal tool, best practice is to use layers from your portal as input.

  • The Determine Travel Cost Path As Polyline tool produces an output feature of least-cost paths from sources to destinations.

  • When the source or the destination input is an image service, cells that are not sources or destinations must have the value NoData. Any cells in either of these inputs that have a value, including zero, will be used as valid sources or destinations.

  • The input cost surface cannot have any zero values or negative values.

Parameters

LabelExplanationData Type
Input Source Raster or Features

An image service or feature service that identifies the cells from which the least-cost path is determined to the destinations.

If the input is an image service, the input consists of cells that have valid values (zero is a valid value), and the remaining cells must be assigned NoData.

Raster Layer; Image Service; Feature Layer; String
Input Cost Raster

The name of a cost raster image service to be used to determine the least-cost path from the sources to the destinations.

The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell.

The values of the cost raster can be integer or floating point, but they cannot be negative or zero (you cannot have a negative or zero cost).

Raster Layer; Image Service; String
Input Destination Raster or Features

An image service or feature service that identifies the cells to which the least-cost path is calculated.

Raster Layer; Image Service; Feature Layer; String
Output Polyline Name

The name of the output polyline feature service.

The polyline feature service of the optimum (least-cost) paths connecting sources and destinations.

Each path (or line) is uniquely numbered, and has an additional field in the attribute table called DestID, which connects it back to the unique identifier on the destination raster.

Since each path is represented by a unique line, there can be multiple lines in locations where paths travel the same route.

String
Path Type
(Optional)

Specifies the manner in which the values and zones on the input destination data will be interpreted in the cost path calculations.

  • To each cellFor each cell or location with valid values on the input destination data, a least-cost path is determined and saved on the output. With this option, each cell or location of the input destination data is treated separately, and a least-cost path is determined for each from cell.
  • To each zoneFor each zone on the input destination data, a least-cost path is determined and saved to the output. With this option, the least-cost path for each zone begins at the location with the lowest cost distance weighting in the zone.
  • Best singleFor all locations on the input destination data, the least-cost path is derived from the location with the minimum of the least-cost paths to source locations. This is the default.
String
Destination Field
(Optional)

The field used to obtain values for the destination locations.

Input feature data must contain at least one valid integer field.

Field

Derived Output

LabelExplanationData Type
Output Polyline Features

The output polyline features.

Feature Class

arcpy.ra.DetermineTravelCostPathAsPolyline(inputSourceRasterOrFeatures, inputCostRaster, inputDestinationRasterOrFeatures, outputPolylineName, {pathType}, {destinationField})
NameExplanationData Type
inputSourceRasterOrFeatures

An image service or feature service that identifies the cells from which the least-cost path is determined to the destinations.

If the input is an image service, the input consists of cells that have valid values (zero is a valid value), and the remaining cells must be assigned NoData.

Raster Layer; Image Service; Feature Layer; String
inputCostRaster

The name of a cost raster image service to be used to determine the least-cost path from the sources to the destinations.

The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell.

The values of the cost raster can be integer or floating point, but they cannot be negative or zero (you cannot have a negative or zero cost).

Raster Layer; Image Service; String
inputDestinationRasterOrFeatures

An image service or feature service that identifies the cells to which the least-cost path is calculated.

Raster Layer; Image Service; Feature Layer; String
outputPolylineName

The name of the output polyline feature service.

The polyline feature service of the optimum (least-cost) paths connecting sources and destinations.

Each path (or line) is uniquely numbered, and has an additional field in the attribute table called DestID, which connects it back to the unique identifier on the destination raster.

Since each path is represented by a unique line, there can be multiple lines in locations where paths travel the same route.

String
pathType
(Optional)

Specifies the manner in which the values and zones on the input destination data will be interpreted in the cost path calculations.

  • EACH_CELLFor each cell or location with valid values on the input destination data, a least-cost path is determined and saved on the output. With this option, each cell or location of the input destination data is treated separately, and a least-cost path is determined for each from cell.
  • EACH_ZONEFor each zone on the input destination data, a least-cost path is determined and saved to the output. With this option, the least-cost path for each zone begins at the location with the lowest cost distance weighting in the zone.
  • BEST_SINGLEFor all locations on the input destination data, the least-cost path is derived from the location with the minimum of the least-cost paths to source locations. This is the default.
String
destinationField
(Optional)

The field used to obtain values for the destination locations.

Input feature data must contain at least one valid integer field.

Field

Derived Output

NameExplanationData Type
outputPolylineFeatures

The output polyline features.

Feature Class

Code sample

DetermineTravelCostPathAsPolyline example 1 (Python window)

This example calculates the travel cost to destinations.

import arcpy

arcpy.ra.DetermineTravelCostPathAsPolyline(
    "https://myserver/rest/services/sources/ImageServer", 
    "https://myserver/rest/services/costsurface/ImageServer", 
    "https://myserver/rest/services/destination/ImageServer", 
    "outpath", "BEST_SINGLE")
DetermineTravelCostPathAsPolyline example 2 (stand-alone script)

This example calculates the travel cost to destinations.

#-------------------------------------------------------------------------------
# Name: DetermineTravelCostPathAsPolyline_Ex_02.py
# Description: Calculates the optimum travel cost path.
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inputSourceLayer =
    'https://MyPortal.esri.com/server/rest/services/Hosted/sources/ImageServer'
inputCostLayer =
    'https://MyPortal.esri.com/server/rest/services/Hosted/costraster/ImageServer'
inputDestinationLayer = 
    'https://MyPortal.esri.com/server/rest/services/Hosted/destinationras/ImageServer'
outputName = 'outTravelPaths'
pathType = 'BEST_SINGLE'

arcpy.ra.DetermineTravelCostPathAsPolyline(inputSourceLayer, inputCostLayer,
                                           inputDestinationLayer, outputName, pathType)

Licensing information

  • Basic: Requires ArcGIS Image Server
  • Standard: Requires ArcGIS Image Server
  • Advanced: Requires ArcGIS Image Server

Related topics