You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Distance (Spatial Analyst)

# Corridor

Release 9.2

Print all topics in : "Distance (Spatial Analyst)"

Related Topics

Calculates the sum of accumulative costs for two input accumulative cost rasters.

Usage tips

Command line and Scripting

• Any two floating-point rasters can be used for the input (for example, an accumulative cost raster), but both inputs should be the result of a global cost function.

• If the two input rasters were created from a global cost function and left unaltered, the output will always contain floating-point values.

• The order of input is irrelevant.

• Map Algebra

• Any two floating-point rasters can be used for the input (for example, an accumulative cost raster), but both inputs should be the result of a global cost function.

• If the two input rasters were created from a global cost function and left unaltered, the output will always contain floating-point values.

• Learn more about how to specify the input raster dataset in the Map Algebra expression of Raster Calculator.

• ArcObjects

• Any two floating-point rasters can be used for the input (for example, an accumulative cost raster), but both inputs should be the result of a global cost function.

• If the two input rasters were created from a global cost function and left unaltered, the output will always contain floating-point values.

• The output from the ArcObjects method is a raster object.

Command line syntax
An overview of the Command Line window
Corridor_sa <in_distance_raster1> <in_distance_raster2> <out_raster>

 Parameter Explanation Data Type An input raster that was the output accumulated cost raster from a global cost function. Composite Geodataset An input raster that was the output accumulated cost raster from a global cost function. Composite Geodataset The raster to be created. Raster Dataset
Data types for geoprocessing tool parameters

### Command line example

`Corridor_sa C:/data/raster_1 C:/data/raster_2 C:/data/final_1`

Scripting syntax
About getting started with writing geoprocessing scripts
Corridor_sa (in_distance_raster1, in_distance_raster2, out_raster)

 Parameter Explanation Data Type in_distance_raster1 (Required) An input raster that was the output accumulated cost raster from a global cost function. Composite Geodataset in_distance_raster2 (Required) An input raster that was the output accumulated cost raster from a global cost function. Composite Geodataset out_raster (Required) The raster to be created. Raster Dataset

Data types for geoprocessing tool parameters

### Script example

```# Corridor_sample.py
# Description:
#   Calculates the sum of accumulative costs for two input
#   accumulative cost rasters.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
# Set local variables
InRaster1 = "C:/data/raster_1"
InRaster2 = "C:/data/raster_2"
OutRaster = "C:/data/final_1"

# Check out Spatial Analyst extension license
gp.CheckOutExtension("Spatial")

# Process: Corridor
gp.Corridor_sa(InRaster1, InRaster2, OutRaster)

except:
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
```

Map Algebra syntax
Corridor(<accum_grid1>, <accum_grid2>)

 Parameter Explanation An input raster that was the output accumulated cost raster from a global cost function. An input raster that was the output accumulated cost raster from a global cost function.

### Map Algebra example

```corridor(ingrid1, ingrid2)
corridor(ingrid1, (ingrid2 + ingrid3))
corridor(ingrid1, costdistance(source, weight))```

ArcObjects syntax
IDistanceOp::Corridor (distance1 As IGeoDataset, distance2 As IGeoDataset) As IGeoDataset

 Parameter Explanation distance1 An input Raster that was the output accumulated cost raster from the IDistance::CostDistance or other Cost method. distance2 An input Raster that was the output accumulated cost raster from the IDistance::CostDistance or other Cost method.

### ArcObjects example

```' Create the RasterDistanceOp object
Dim pDistanceOp As IDistanceOp
Set pDistanceOp = New RasterDistanceOp

' Declare the input distance 1 raster object
Dim pDistance1Dataset As IGeoDataset

' Calls function to open a raster dataset from disk
Set pDistance1Dataset = OpenRasterDataset("D:\SpatialData", "dist1raster")

' Declare the input distance 2 raster object
Dim pDistance2Dataset As IGeoDataset

' Calls function to open a raster dataset from disk
Set pDistance2Dataset = OpenRasterDataset("D:\SpatialData", "dist2raster")

' Declare the output raster object
Dim pOutputRaster As IGeoDataset

' Calls the method
Set pOutputRaster = pDistanceOp.Corridor(pDistance1Dataset, pDistance2Dataset)```

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.