The cost-accumulation tool can be used to perform cost-distance or least-cost pathway analyses. Specifically, this tool can be used to calculate the accumulated cost of traveling from the 'source grid cell' to each other grid cell in a raster dataset. It is based on the costs associated with traveling through each cell along a pathway represented in a cost (or friction) surface. If there are multiple source grid cells, each cell in the resulting cost-accumulation surface will reflect the accumulated cost to the source cell that is connected by the minimum accumulated cost-path. The user must specify the names of the raster file containing the source cells (Input Source Raster), the raster file containing the cost surface information (Input Cost-Friction Raster), the output Cost-accumulation Surface Raster, and the output Back-Link Raster. Source cells are designated as all positive, non-zero valued grid cells in the Source Raster. The Cost (Friction) Raster can be created by combining the various cost factors associated with the specific problem (e.g. slope gradient, visibility, etc.) using the raster calculator or the Weighted Overlay tool. While the Cost-accumulation Surface Raster can be helpful for visualizing the three-dimensional characteristics of the 'cost landscape', it is actually the Back-Link Raster that is used as inputs to the other two cost-distance tools, Cost Allocation and Cost Pathway, to determine the least-cost linkages among neighbouring grid cells on the cost surface. If the accumulated cost surface is analogous to a digital elevation model (DEM) then the Back-Link Raster is equivalent to the D8 flow-direction pointer. In fact, it is created in exactly the same way and uses the same convention for designating 'flow directions' between neighbouring grid cells.
The cost of moving through a cell will be considered to be directionally invariant (i.e. isotropic; it is the same cost to travel northward through a cell as it is to travel eastward) if the user does not specify values for either the anisotropic direction or strength. An anisotropic bias can be added to the process of calculating the outputs by specifying an anisotropic direction (a number between 0 and 360 degrees) and an anisotropic strength (a number between -100 and 100).
The two input grids must have the same dimensions. The algorithm operates in an interactive manner. Depending on the size of the input grids and the complexity of the cost surface, the tool may take considerable time to complete. NoData values in the input cost surface image are ignored during processing and assigned NoData values in the outputs. The output cost accumulation raster is of the float data type and continuous data scale. The output back-link raster is of the integer data type and the continuous data scale.
The following is an example of a Python script that uses this tool:
wd = pluginHost.getWorkingDirectory()
sourceFile = wd + "source.dep"
costFile = wd + "cost.dep"
outCostAccumFile = wd + "cost accum.dep"
outBackLink = wd + "back link.dep"
forceDirection = "not specified"
forceStrength = "not specified
args = [sourceFile, costFile, outCostAccumFile, outBackLink, forceDirection, forceStrength]
pluginHost.runPlugin("CostAccumulation", args, False)
This is a Groovy script also using this tool:
def wd = pluginHost.getWorkingDirectory()
def sourceFile = wd + "source.dep"
def costFile = wd + "cost.dep"
def outCostAccumFile = wd + "cost accum.dep"
def outBackLink = wd + "back link.dep"
def forceDirection = "215.0"
def forceStrength = "75.0"
String args = [sourceFile, costFile, outCostAccumFile, outBackLink, forceDirection, forceStrength]
pluginHost.runPlugin("CostAccumulation", args, false)