Distance Accumulation (Spatial Analyst)

Available with Spatial Analyst license.

Summary

Calculates accumulated distance for each cell to sources, allowing for straight-line distance, cost distance, and true surface distance, as well as vertical and horizontal cost factors.

Learn more about how the distance accumulation tools work

Usage

  • The input source data can be a feature class or a raster. The feature class can be point, line or polygon.

  • When the input source data is a raster, the set of source cells consists of all cells in the source raster that have valid values. Cells that have NoData values are not included in the source set. The value 0 is considered a legitimate source. A source raster can be created using the extraction tools.

  • When the input source data is a feature class, the source locations are converted internally to a raster before performing the analysis. The resolution of the raster can be controlled with the Cell Size environment. By default, if no other rasters are specified in the tool, the resolution will be determined by the shorter of the width or height of the extent of the input feature, in the input spatial reference, divided by 250.

  • When using feature data for the input source data, care must be taken with how the output cell size is handled when it is coarse, relative to the detail present in the input. The internal rasterization process uses the same default Cell assignment type value as the Feature to Raster tool, which is the cell center method. This means that data that is not located at the center of the cell will not be included in the intermediate rasterized source output, so it will not be represented in the distance calculations. For example, if the sources 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 will fall under the centers of the output raster cells, seemingly causing most of the others to be lost in the analysis.

    To avoid this situation, as an intermediate step, you can rasterize the input features directly with the Feature to Raster tool and set the Field parameter. Then use the resulting output as input to the particular distance tool you want to use. Alternatively, you can select a small cell size to capture the appropriate amount of detail from the input features.

  • Barriers are obstacles that must be routed around. They can be defined in two ways.

    For the Input barrier raster or feature data parameter, barriers can be represented either by cells that have a valid value or by feature data that is converted to a raster. Where barriers are connected only by diagonal cells, the barriers will be thickened to make them impermeable.

    Barriers are also defined by locations where NoData cells exist in the following inputs: Input cost raster, Input surface raster, Input vertical raster, and Input horizontal raster. Where NoData is connected only by diagonal cells, it will be thickened with additional NoData cells to make it an impermeable barrier.

  • If the Input surface raster value has a vertical coordinate system (VCS), the values of the surface raster are considered to be in the units of the VCS. If the Input surface raster value does not have a VCS and the data is projected, the surface values are considered to be in the linear units of the spatial reference. If the Input surface raster value does not have a VCS and the data is not projected, the surface values are considered to be in meters. The final distance accumulation result is in cost per linear unit, or in linear units if no cost is introduced.

  • If a source falls on NoData in any of the corresponding input rasters, it will be ignored in the analysis and no distance from that source will be calculated.

  • The default values for the Vertical factor modifiers are the following:

    Keyword                   Zero    Low    High   Slope  Power  Cos    Sec
                              factor  cut    cut                  power  power
                                      angle  angle                             
    ------------------------  ------  -----  -----  -----  -----  -----  -----
    Binary                    1.0     -30    30     ~      ~      ~      ~
    Linear                    1.0     -90    90      1/90  ~      ~      ~
    Symmetric linear          1.0     -90    90      1/90  ~      ~      ~
    Inverse linear            1.0     -45    45     -1/45  ~      ~      ~
    Symmetric inverse linear  1.0     -45    45     -1/45  ~      ~      ~
    Cos                       ~       -90    90     ~      1.0    ~      ~
    Sec                       ~       -90    90     ~      1.0    ~      ~
    Cos_sec                   ~       -90    90     ~      ~      1.0    1.0
    Sec_cos                   ~       -90    90     ~      ~      1.0    1.0
  • The output of the Aspect tool can be used as input for the Input horizontal raster parameter.

  • The default values for the Horizontal factor modifiers are the following:

    Keywords       Zero factor   Cut angle     Slope   Side value
    --------------   -----------   -----------   -----   ---------
    Binary           1.0            45           ~       ~
    Forward          0.5            45 (fixed)   ~       1.0
    Linear           0.5           181            1/90   ~
    Inverse linear   2.0           180           -1/90   ~
  • The characteristics of the source, or the movers from or to a source, can be controlled by specific parameters.

    • Initial accumulation sets the initial cost before the movement begins.
    • Maximum accumulation specifies how much cost a source can accumulate before reaching its limit.
    • Multiplier to apply to costs specifies the mode of travel or magnitude at the source.
    • Travel direction identifies whether the mover is starting at a source and moving to nonsource locations or starting at nonsource locations and moving back to a source.

  • If any of the source characteristics parameters are specified using a field, the source characteristic will be applied on a source-by-source basis, according to the information in the given field for the source data. When a keyword or a constant value is given, it will be applied to all sources.

  • If Initial accumulation is specified, the source locations on the output cost distance surface will be set to the Initial accumulation value; otherwise, the source locations on the output cost distance surface will be set to zero.

  • When no Extent environment setting is specified, the processing extent is determined in the following way:

    If only the Input raster or feature source data and Input barrier raster or feature data values are specified, the union of the inputs, expanded by two cell widths on each side, will be used as the processing extent. The reason the output raster is expanded by two rows and columns is so that the outputs can be used in Optimal Path As Line and Optimal Path As Raster and the generated paths can move around the barriers. To use the extent as an implicit barrier, you must explicitly set the Extent value in the environment settings.

    The processing extent will be the intersection of Input surface raster, Input cost raster, Input vertical raster, or Input horizontal raster, if specified.

  • The analysis Mask environment can be set to a feature or a raster dataset. If the mask is a feature, it will be converted to a raster. The cells that have a value define the locations that are within the mask area. NoData cells define the locations that are outside the mask area and will be treated as a barrier.

  • When the Cell Size or Snap Raster environment settings are not specified and there are multiple rasters specified as inputs, the Cell Size and Snap Raster environments are set based on an order of precedence: Input cost raster, Input surface raster, Input vertical raster, Input horizontal raster, Input raster or feature source data, and Input barrier raster or feature data.

  • This tool supports parallel processing. If your computer has multiple processors or processors with multiple cores, better performance may be achieved, particularly on larger datasets. See the Parallel processing with Spatial Analyst help topic for details on this capability and how to configure it.

    When using parallel processing, temporary data will be written to manage the data chunks being processed. The default temp folder location will be on your local C: drive. You can control the location of this folder by setting up a system environment variable named TempFolders and specifying the path to a folder to use (for example, E:\RasterCache). If you have admin privileges on your machine, you can also use a registry key (for example, [HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro\Raster]).

    By default, this tool will use 50 percent of the available cores. If the input data is smaller than 5,000 by 5,000 cells in size, fewer cores may be used. You can control the number of cores the tool uses with the Parallel processing factor environment.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input raster or feature source data

The input source locations.

This is a raster or feature (point, line, or polygon) identifying the cells or locations that will be used to calculate the least accumulated cost distance for each output cell location.

For rasters, the input type can be integer or floating point.

Raster Layer; Feature Layer
Input barrier raster or feature data
(Optional)

The dataset that defines the barriers.

The barriers can be defined by an integer or a floating-point raster, or by a point, line, or polygon feature.

For a raster barrier, the barrier must have a valid value, including zero, and the areas that are not barriers must be NoData.

Raster Layer; Feature Layer
Input surface raster
(Optional)

A raster defining the elevation values at each cell location.

The values are used to calculate the actual surface distance covered when passing between cells.

Raster Layer
Input cost raster
(Optional)

A raster defining the impedance or cost to move planimetrically through each cell.

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
Input vertical raster
(Optional)

A raster defining the z-values for each cell location.

The values are used for calculating the slope used to identify the vertical factor incurred when moving from one cell to another.

Raster Layer
Vertical factor
(Optional)

Specifies the relationship between the vertical cost factor and the vertical relative moving angle (VRMA).

There are several factors with modifiers that identify a defined vertical factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the vertical factor used in calculating the total cost for moving into a neighboring cell.

In the descriptions below, two acronyms are used: VF stands for vertical factor, which defines the vertical difficulty encountered in moving from one cell to the next; and VRMA stands for vertical relative moving angle, which identifies the slope angle between the FROM or processing cell and the TO cell.

The Vertical factor options are as follows:

  • Binary—If the VRMA is greater than the low-cut angle and less than the high-cut angle, the VF is set to the value associated with the zero factor; otherwise, it is infinity.
  • Linear—The VF is a linear function of the VRMA.
  • Symmetric Linear—The VF is a linear function of the VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.
  • Inverse Linear—The VF is an inverse linear function of the VRMA.
  • Symmetric Inverse Linear—The VF is an inverse linear function of the VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.
  • Cos—The VF is the cosine-based function of the VRMA.
  • Sec—The VF is the secant-based function of the VRMA.
  • Cos-Sec—The VF is the cosine-based function of the VRMA when the VRMA is negative and is the secant-based function of the VRMA when the VRMA is not negative.
  • Sec-Cos—The VF is the secant-based function of the VRMA when the VRMA is negative and is the cosine-based function of the VRMA when the VRMA is not negative.
  • Table—A table file will be used to define the vertical-factor graph that is used to determine the VFs.

Modifiers to the vertical keywords are the following:

  • Zero factor—The vertical factor used when the VRMA is zero. This factor positions the y-intercept of the specified function. By definition, the zero factor is not applicable to any of the trigonometric vertical functions (COS, SEC, COS-SEC, or SEC-COS). The y-intercept is defined by these functions.
  • Low Cut angle—The VRMA angle below which the VF will be set to infinity.
  • High Cut angle—The VRMA angle above which the VF will be set to infinity.
  • Slope—The slope of the straight line used with the Linear and Inverse Linear vertical-factor keywords. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).
  • Table name—The name of the table defining the VF.
Vertical Factor
Input horizontal raster
(Optional)

A raster defining the horizontal direction at each cell.

The values on the raster must be integers ranging from 0 to 360, with 0 degrees being north, or toward the top of the screen, and increasing clockwise. Flat areas should be given a value of -1. The values at each location will be used in conjunction with the Horizontal factor parameter to determine the horizontal cost incurred when moving from a cell to its neighbors.

Raster Layer
Horizontal factor
(Optional)

Specifies the relationship between the horizontal cost factor and the horizontal relative moving angle (HRMA).

There are several factors with modifiers that identify a defined horizontal factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the horizontal factor used in calculating the total cost of moving into a neighboring cell.

In the descriptions below, two acronyms are used: HF stands for horizontal factor, which defines the horizontal difficulty encountered when moving from one cell to the next; and HRMA stands for horizontal relative moving angle, which identifies the angle between the horizontal direction from a cell and the moving direction.

The Horizontal factor options are as follows:

  • Binary—If the HRMA is less than the cut angle, the HF is set to the value associated with the zero factor; otherwise, it is infinity.
  • Forward—Only forward movement is allowed. The HRMA must be greater than or equal to 0 and less than 90 degrees (0 <= HRMA < 90). If the HRMA is greater than 0 and less than 45 degrees, the HF for the cell is set to the value associated with the zero factor. If the HRMA is greater than or equal to 45 degrees, the side value modifier value is used. The HF for any HRMA equal to or greater than 90 degrees is set to infinity.
  • Linear—The HF is a linear function of the HRMA.
  • Inverse Linear—The HF is an inverse linear function of the HRMA.
  • Table—A table file will be used to define the horizontal factor graph used to determine the HFs.

Modifiers to the horizontal factors are the following:

  • Zero factor—The horizontal factor to be used when the HRMA is zero. This factor positions the y-intercept for any of the horizontal factor functions.
  • Cut angle—The HRMA angle beyond which the HF will be set to infinity.
  • Slope—The slope of the straight line used with the Linear and Inverse Linear horizontal factor keywords. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).
  • Side value—The HF when the HRMA is greater than or equal to 45 degrees and less than 90 degrees when the Forward horizontal-factor keyword is specified.
  • Table name—The name of the table defining the HF.
Horizontal Factor
Out back direction raster
(Optional)

The back direction raster contains the calculated direction in degrees. The direction identifies the next cell along the shortest path back to the closest 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).

The output raster is of type float.

Raster Dataset
Out source direction raster
(Optional)

The source direction raster identifies the direction of the least accumulated cost source cell as an azimuth in degrees.

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

The output raster is of type float.

Raster Dataset
Out source location raster
(Optional)

The source location raster is a multiband output. The first band contains a row index, and the second band contains a column index. These indexes identify the location of the source cell that is the least accumulated cost distance away.

Raster Dataset
Initial accumulation
(Optional)

The initial accumulative cost that will be used to begin the cost calculation.

Allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of zero, the cost algorithm will begin with the value set by Initial accumulation.

The values must be zero or greater. The default is 0.

Double; Field
Maximum accumulation
(Optional)

The maximum accumulation for the traveler for a source.

The cost calculations continue for each source until the specified accumulation is reached.

The values must be greater than zero. The default accumulation is to the edge of the output raster.

Double; Field
Multiplier to apply to costs
(Optional)

The multiplier that will be applied to the cost values.

This allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell.

The values must be greater than zero. The default is 1.

Double; Field
Travel direction
(Optional)

Specifies the direction of the traveler when applying horizontal and vertical factors.

If you select the String option, you can choose between from and to options, which will be applied to all sources.

If you select the Field option, you can select the field from the source data that determines the direction to use for each source. The field must contain the text string FROM_SOURCE or TO_SOURCE.

  • Travel from sourceThe horizontal factor and vertical factor will be applied beginning at the input source and travel out to the nonsource cells. This is the default.
  • Travel to sourceThe horizontal factor and vertical factor will be applied beginning at each nonsource cell and travel back to the input source.
String; Field
Distance Method
(Optional)

Specifies whether the distance will be calculated using a planar (flat earth) or a geodesic (ellipsoid) method.

  • PlanarThe distance calculation will be performed on a projected flat plane using a 2D Cartesian coordinate system. This is the default.
  • GeodesicThe distance calculation will be performed on the ellipsoid. Regardless of input or output projection, the results will not change.
String

Return Value

LabelExplanationData Type
Output distance accumulation raster

The output distance raster.

The output raster is of floating-point type.

Raster

DistanceAccumulation(in_source_data, {in_barrier_data}, {in_surface_raster}, {in_cost_raster}, {in_vertical_raster}, {vertical_factor}, {in_horizontal_raster}, {horizontal_factor}, {out_back_direction_raster}, {out_source_direction_raster}, {out_source_location_raster}, {source_initial_accumulation}, {source_maximum_accumulation}, {source_cost_multiplier}, {source_direction}, {distance_method})
NameExplanationData Type
in_source_data

The input source locations.

This is a raster or feature (point, line, or polygon) identifying the cells or locations that will be used to calculate the least accumulated cost distance for each output cell location.

For rasters, the input type can be integer or floating point.

Raster Layer; Feature Layer
in_barrier_data
(Optional)

The dataset that defines the barriers.

The barriers can be defined by an integer or a floating-point raster, or by a point, line, or polygon feature.

For a raster barrier, the barrier must have a valid value, including zero, and the areas that are not barriers must be NoData.

Raster Layer; Feature Layer
in_surface_raster
(Optional)

A raster defining the elevation values at each cell location.

The values are used to calculate the actual surface distance covered when passing between cells.

Raster Layer
in_cost_raster
(Optional)

A raster defining the impedance or cost to move planimetrically through each cell.

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
in_vertical_raster
(Optional)

A raster defining the z-values for each cell location.

The values are used for calculating the slope used to identify the vertical factor incurred when moving from one cell to another.

Raster Layer
vertical_factor
(Optional)

The Vertical factor object defines the relationship between the vertical cost factor and the vertical relative moving angle (VRMA).

There are several factors with modifiers that identify a defined vertical factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the vertical factor used in calculating the total cost for moving into a neighboring cell.

In the descriptions below, two acronyms are used: VF stands for vertical factor, which defines the vertical difficulty encountered in moving from one cell to the next; and VRMA stands for vertical relative moving angle, which identifies the slope angle between the FROM or processing cell and the TO cell.

The object comes in the following forms:

The definitions and parameters of these are the following:

  • VfBinary({zeroFactor}, {lowCutAngle}, {highCutAngle})

    If the VRMA is greater than the low-cut angle and less than the high-cut angle, the VF is set to the value associated with the zero factor; otherwise, it is infinity.

  • VfLinear({zeroFactor}, {lowCutAngle}, {highCutAngle}, {slope})

    The VF is a linear function of the VRMA.

  • VfInverseLinear({zeroFactor}, {lowCutAngle}, {highCutAngle}, {slope})

    The VF is an inverse linear function of the VRMA.

  • VfSymLinear({zeroFactor}, {lowCutAngle}, {highCutAngle}, {slope})

    The VF is a linear function of the VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.

  • VfSymInverseLinear({zeroFactor}, {lowCutAngle}, {highCutAngle}, {slope})

    The VF is an inverse linear function of the VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.

  • VfCos({lowCutAngle}, {highCutAngle}, {cosPower})

    The VF is the cosine-based function of the VRMA.

  • VfSec({lowCutAngle}, {highCutAngle}, {secPower})

    The VF is the secant-based function of the VRMA.

  • VfCosSec({lowCutAngle}, {highCutAngle}, {cosPower}, {secPower})

    The VF is the cosine-based function of the VRMA when the VRMA is negative and is the secant-based function of the VRMA when the VRMA is not negative.

  • VfSecCos({lowCutAngle}, {highCutAngle}, {secPower}, {cos_power})

    The VF is the secant-based function of the VRMA when the VRMA is negative and is the cosine-based function of the VRMA when the VRMA is not negative.

  • VfTable(inTable)

    A table file will be used to define the vertical-factor graph used to determine the VFs.

The modifiers to the vertical parameters are the following:

  • zeroFactor—The vertical factor used when the VRMA is zero. This factor positions the y-intercept of the specified function. By definition, the zero factor is not applicable to any of the trigonometric vertical functions (Cos, Sec, Cos-Sec, or Sec-Cos). The y-intercept is defined by these functions.
  • lowCutAngle—The VRMA angle below which the VF will be set to infinity.
  • highCutAngle—The VRMA angle above which the VF will be set to infinity.
  • slope—The slope of the straight line used with the VfLinear and VfInverseLinear parameters. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).
  • inTable—The name of the table defining the VF.
Vertical Factor
in_horizontal_raster
(Optional)

A raster defining the horizontal direction at each cell.

The values on the raster must be integers ranging from 0 to 360, with 0 degrees being north, or toward the top of the screen, and increasing clockwise. Flat areas should be given a value of -1. The values at each location will be used in conjunction with the horizontal_factor parameter to determine the horizontal cost incurred when moving from a cell to its neighbors.

Raster Layer
horizontal_factor
(Optional)

The Horizontal Factor object defines the relationship between the horizontal cost factor and the horizontal relative moving angle.

There are several factors with modifiers that identify a defined horizontal factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the horizontal factor used in calculating the total cost of moving into a neighboring cell.

In the descriptions below, two acronyms are used: HF stands for horizontal factor, which defines the horizontal difficulty encountered when moving from one cell to the next; and HRMA stands for horizontal relative moving angle, which identifies the angle between the horizontal direction from a cell and the moving direction.

The object comes in the following forms:

The definitions and parameters of these are the following:

  • HfBinary({zeroFactor}, {cutAngle})

    If the HRMA is less than the cut angle, the HF is set to the value associated with the zero factor; otherwise, it is infinity.

  • HfForward({zeroFactor}, {sideValue})

    Only forward movement is allowed. The HRMA must be greater than or equal to 0 and less than 90 (0 <= HRMA < 90). If the HRMA is greater than 0 and less than 45 degrees, the HF for the cell is set to the value associated with the zero factor. If the HRMA is greater than or equal to 45 degrees, the side value modifier value is used. The HF for any HRMA equal to or greater than 90 degrees is set to infinity.

  • HfLinear({zeroFactor}, {cutAngle}, {slope})

    The HF is a linear function of the HRMA.

  • HfInverseLinear({zeroFactor}, {cutAngle}, {slope})

    The HF is an inverse linear function of the HRMA.

  • HfTable(inTable)

    A table file will be used to define the horizontal factor graph used to determine the HFs.

The modifiers to the horizontal keywords are the following:

  • zeroFactor—The horizontal factor to be used when the HRMA is 0. This factor positions the y-intercept for any of the horizontal factor functions.
  • cutAngle—The HRMA angle beyond which the HF will be set to infinity.
  • slope—The slope of the straight line used with the HfLinear and HfInverseLinear horizontal-factor keywords. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).
  • sideValue—The HF when the HRMA is greater than or equal to 45 degrees and less than 90 degrees when the HfForward horizontal-factor keyword is specified.
  • inTable—The name of the table defining the HF.

Horizontal Factor
out_back_direction_raster
(Optional)

The back direction raster contains the calculated direction in degrees. The direction identifies the next cell along the shortest path back to the closest 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).

The output raster is of type float.

Raster Dataset
out_source_direction_raster
(Optional)

The source direction raster identifies the direction of the least accumulated cost source cell as an azimuth in degrees.

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

The output raster is of type float.

Raster Dataset
out_source_location_raster
(Optional)

The source location raster is a multiband output. The first band contains a row index, and the second band contains a column index. These indexes identify the location of the source cell that is the least accumulated cost distance away.

Raster Dataset
source_initial_accumulation
(Optional)

The initial accumulative cost that will be used to begin the cost calculation.

Allows for the specification of the fixed cost associated with a source. Instead of starting at a cost of zero, the cost algorithm will begin with the value set by source_initial_accumulation.

The values must be zero or greater. The default is 0.

Double; Field
source_maximum_accumulation
(Optional)

The maximum accumulation for the traveler for a source.

The cost calculations continue for each source until the specified accumulation is reached.

The values must be greater than zero. The default accumulation is to the edge of the output raster.

Double; Field
source_cost_multiplier
(Optional)

The multiplier that will be applied to the cost values.

This allows for control of the mode of travel or the magnitude at a source. The greater the multiplier, the greater the cost to move through each cell.

The values must be greater than zero. The default is 1.

Double; Field
source_direction
(Optional)

Specifies the direction of the traveler when applying horizontal and vertical factors.

  • FROM_SOURCEThe horizontal factor and vertical factor will be applied beginning at the input source and travel out to the nonsource cells. This is the default.
  • TO_SOURCEThe horizontal factor and vertical factor will be applied beginning at each nonsource cell and travel back to the input source.

Specify the FROM_SOURCE or TO_SOURCE keyword, which will be applied to all sources, or specify a field in the source data that contains the keywords to identify the direction of travel for each source. That field must contain the string FROM_SOURCE or TO_SOURCE.

String; Field
distance_method
(Optional)

Specifies whether the distance will be calculated using a planar (flat earth) or a geodesic (ellipsoid) method.

  • PLANARThe distance calculation will be performed on a projected flat plane using a 2D Cartesian coordinate system. This is the default.
  • GEODESICThe distance calculation will be performed on the ellipsoid. Regardless of input or output projection, the results will not change.
String

Return Value

NameExplanationData Type
out_distance_accumulation_raster

The output distance raster.

The output raster is of floating-point type.

Raster

Code sample

DistanceAccumulation example 1 (Python window)

The following Python Window script demonstrates how to use the DistanceAccumulation tool.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outDistAcc = DistanceAccumulation("insources.shp", "barriers.tif")
outDistAcc.save("c:/sapyexamples/output/distacc.tif")
DistanceAccumulation example 2 (stand-alone script)

Calculate, for each cell, the least accumulative cost distance to the nearest source, while accounting for surface distance and horizontal and vertical cost factors.

# Name: DistanceAccumulation_Ex_02.py
# Description: Calculates the distance accumulation.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inSources = "insources.shp"
inBarrier = "barriers.tif"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Execute EucDirections
outDistAcc = DistanceAccumulation(inSources, inBarrier)

# Save the output 
outDistAcc.save("c:/sapyexamples/output/distacc2.tif")