In
spatial analysis
Spatial analysis or spatial statistics includes any of the formal techniques which studies entities using their topological, geometric, or geographic properties. Spatial analysis includes a variety of techniques, many still in their early deve ...
and
geographic information system
A geographic information system (GIS) is a type of database containing Geographic data and information, geographic data (that is, descriptions of phenomena for which location is relevant), combined with Geographic information system software, sof ...
s, cost distance analysis or cost path analysis is a method for determining one or more optimal routes of travel through unconstrained (two-dimensional) space.
[de Smith, Michael, Paul Longley, Michael Goodchild (2018]
Cost Distance
''Geospatial Analysis'', 6th Edition The optimal solution is that which minimizes the total cost of the route, based on a
field of cost density (cost per linear unit) that varies over space due to local factors. It is thus based on the fundamental geographic principle of
Friction of distance
Friction of distance is a core principle of Geography that states that movement incurs some form of cost, in the form of physical effort, energy, time, and/or the expenditure of other resources, and that these costs are proportional to the distanc ...
. It is an
optimization problem
In mathematics, computer science and economics, an optimization problem is the problem of finding the ''best'' solution from all feasible solutions.
Optimization problems can be divided into two categories, depending on whether the variables ...
with multiple
deterministic algorithm
In computer science, a deterministic algorithm is an algorithm that, given a particular input, will always produce the same output, with the underlying machine always passing through the same sequence of states. Deterministic algorithms are by far ...
solutions, implemented in most GIS software.
The various problems, algorithms, and tools of cost distance analysis operate over an unconstrained two-dimensional space, meaning that a path could be of any shape. Similar cost optimization problems can also arise in a constrained space, especially a one-dimensional
linear network such as a
road or
telecommunications network
A telecommunications network is a group of nodes interconnected by telecommunications links that are used to exchange messages between the nodes. The links may use a variety of technologies based on the methodologies of circuit switching, message ...
. Although they are similar in principle, the problems in network space require very different (usually simpler) algorithms to solve, largely adopted from
graph theory
In mathematics, graph theory is the study of ''graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of '' vertices'' (also called ''nodes'' or ''points'') which are conne ...
. The collection of GIS tools for solving these problems are called ''network analysis''.
History
Humans seem to have an innate desire to travel with minimal effort and time. Historic, even ancient, roads show patterns similar to what modern computational algorithms would generate, traveling straight across flat spaces, but curving around mountains, canyons, and thick vegetation.
However, it was not until the 20th Century that geographers developed theories to explain this route optimization, and algorithms to reproduce it. In 1957, during the
Quantitative revolution
The quantitative revolution (QR) was a paradigm shift that sought to develop a more rigorous and systematic methodology for the discipline of geography. It came as a response to the inadequacy of regional geography to explain general spatial dynam ...
in Geography, with its propensity to adopt principles or mathematical formalisms from the "hard" sciences (known as
social physics Social physics or sociophysics is a field of science which uses mathematical tools inspired by physics to understand the behavior of human crowds. In a modern commercial use, it can also refer to the analysis of social phenomena with big data.
Soci ...
), William Warntz used
refraction
In physics, refraction is the redirection of a wave as it passes from one medium to another. The redirection can be caused by the wave's change in speed or by a change in the medium. Refraction of light is the most commonly observed phenomeno ...
as an analogy for how minimizing travel cost will make transportation routes change direction at the boundary between two landscapes with very different
friction of distance
Friction of distance is a core principle of Geography that states that movement incurs some form of cost, in the form of physical effort, energy, time, and/or the expenditure of other resources, and that these costs are proportional to the distanc ...
(e.g., emerging from a forest into a prairie).
His principle of "parsimonious movement," changing direction to minimize cost, was widely accepted, but the refraction analogy and mathematics (
Snell's law
Snell's law (also known as Snell–Descartes law and ibn-Sahl law and the law of refraction) is a formula used to describe the relationship between the angles of incidence and refraction, when referring to light or other waves passing through ...
) was not, largely because it does not scale well to normally complex geographic situations.
Warntz and others then adopted another analogy that proved much more successful in the common situation where travel cost varies continuously over space, by comparing it to terrain.
[Warntz, William (1965)]
A note on surfaces and paths and applications to geographical problems
''IMaGe Discussion Paper #6'', Ann Arbor: Michigan Inter-University Community of Mathematical Geographers They compared the cost rate (i.e., cost per unit distance, the inverse of velocity if the cost is time) to the slope of a terrain surface (i.e., elevation change per unit distance), both being mathematical derivatives of an accumulated function or field: total elevation above a vertical datum (sea level) in the case of terrain. Integrating the cost rate field from a given starting point would create an analogous surface of total accumulated cost of travel from that point. In the same way that a stream follows the path of least resistance downhill, the streamline on the cost accumulation surface from any point "down" to the source will be the minimum-cost path.
Additional lines of research in the 1960s further developed the nature of the cost rate field as a manifestation of the concept of
friction of distance
Friction of distance is a core principle of Geography that states that movement incurs some form of cost, in the form of physical effort, energy, time, and/or the expenditure of other resources, and that these costs are proportional to the distanc ...
, studying how it was affected by various geographic features.
At the time, this solution was only theoretical, lacking the data and computing power for the continuous solution. Raster GIS provided the first feasible platform for implementing the theoretical solution by converting the continuous integration into a discrete summation procedure.
Dana Tomlin
Charles Dana Tomlin is an author, professor, and originator of Map Algebra, a vocabulary and conceptual framework for classifying ways to combine map data to produce new maps. Tomlin's teaching and research focus on the development and application ...
implemented cost distance analysis in his Map Analysis Package by 1986, and Ronald Eastman added it to
IDRISI by 1989, with a more efficient "pushbroom" cost accumulation algorithm.
[Eastman J R (1989]
Pushbroom algorithms for calculating distances in raster grids
''Proceedings, AutoCarto 9'', pp.288-97 Douglas (1994) further refined the accumulation algorithm, which is basically what is implemented in most current GIS software.
Cost raster

The primary data set used in cost distance analysis is the ''cost raster'', sometimes called the cost-of-passage surface,
the friction image,
the cost-rate field, or cost surface. In most implementations, this is a
raster grid, in which the value of each cell represents the cost (i.e., expended resources, such as time, money, or energy) of a route crossing the cell in a horizontal or vertical direction.
It is thus a
discretization
In applied mathematics, discretization is the process of transferring continuous functions, models, variables, and equations into discrete counterparts. This process is usually carried out as a first step toward making them suitable for numerical ...
of a
field of cost rate (cost per linear unit), a
spatially intensive property. This cost is a manifestation of the principle of
friction of distance
Friction of distance is a core principle of Geography that states that movement incurs some form of cost, in the form of physical effort, energy, time, and/or the expenditure of other resources, and that these costs are proportional to the distanc ...
.
A number of different types of cost may be relevant in a given routing problem:
* Travel cost, the resource expenditure required to move across the cell, usually time or energy/fuel.
* Construction cost, the resources (usually monetary) required to build the infrastructure that makes travel possible, such as roads, pipes, and cables. While some construction costs are constant (e.g., paving material), others are spatially variant, such as property acquisition and excavation.
* Environmental impacts, the negative effects on the natural or human environment caused by the infrastructure or the travel along it. For example, building an expressway through a residential neighborhood or a wetland would incur a high political cost (in the form of environmental impact assessments, protests, lawsuits, etc.).
Some of these costs are easily quantifiable and measurable, such as transit time, fuel consumption, and construction costs, thus naturally lending themselves to computational solutions. That said, there may be significant uncertainty in predicting the cost prior to implementing the route. Other costs are much more difficult to measure due to their qualitative or subjective nature, such as political protest or ecological impact; these typically require
operationalization
In research design, especially in psychology, social sciences, life sciences and physics, operationalization or operationalisation is a process of defining the measurement of a phenomenon which is not directly Measurement, measurable, though its ex ...
through the creation of a
scale.
[G.H. Pirie (2009]
Distance
in Rob Kitchin, Nigel Thrift (eds.) ''International Encyclopedia of Human Geography'', Elsevier, Pages 242-251
doi:10.1016/B978-008044910-4.00265-0
/ref>
In many situations, multiple types of cost may be simultaneously relevant, and the total cost is a combination of them. Because different costs are expressed in different units (or, in the case of scales, no units at all), they usually cannot be directly summed, but must be combined by creating an index. A common type of index is created by scaling each factor to a consistent range (say, ,1, then combining them using weighted linear combination. An important part of the creation of an index model like this is Calibration (statistics)
There are two main uses of the term calibration in statistics that denote special types of statistical inference problems. "Calibration" can mean
:*a reverse process to regression, where instead of a future dependent variable being predicted fro ...
, adjusting the parameters of the formula(s) to make the modeled relative cost match real-world costs, using methods such as the Analytic hierarchy process
In the theory of decision making, the analytic hierarchy process (AHP), also analytical hierarchy process, is a structured technique for organizing and analyzing complex decisions, based on mathematics and psychology. It was developed by Tho ...
. The index model formula is typically implemented in a raster GIS using map algebra
Map algebra is an algebra for manipulating geographic data, primarily Field (geography) , fields. Developed by Dr. Dana Tomlin and others in the late 1970s, it is a set of primitive operations in a geographic information system (GIS) which allows ...
tools from raster grids representing each cost factor, resulting in a single cost raster grid.
Directional cost
One limitation of the traditional method is that the cost field is ''isotropic'' or omni-directional: the cost at a given location does not depend on the direction of traversal. This is appropriate in many situations, but not others. For example, if one is flying in a windy location, an airplane flying in the direction of the wind incurs a much lower cost than an airplane flying against it. Some research has been done on extending cost distance analysis algorithms to incorporate directional cost, but it is not yet widely implemented in GIS software. IDRISI has some support for anisotropy.
Least-cost-path algorithm
The most common cost distance task is to determine the single path through the space between a given source location and a destination location that has the least total accumulated cost. The typical solution algorithm is a discrete raster implementation of the cost integration strategy of Warntz and Lindgren, which is a deterministic ( NP-complete) optimization.
# Inputs: cost field raster, source location, destination location (most implementations can solve for multiple sources and destinations simultaneously)
# Accumulation: Starting at the source location compute the lowest total cost needed to reach every other cell in the grid. Although there are several algorithms, such as those published by Eastman and Douglas, they generally follow a similar strategy. This process also creates, as an important byproduct, a second raster grid usually called the ''backlink grid'' (Esri) or ''movement direction grid'' (GRASS), in which each cell has a direction code (0-7) representing which of its eight neighbors had the lowest cost.
## Find a cell that is adjacent to at least one cell that already has an accumulated cost assigned (initially, this is only the source cell)
## Determine which neighbor has the lowest accumulated cost. Encode the direction from the target to the lowest-cost neighbor in the backlink grid.
## Add the cost of the target cell (or an average of the costs of the target and neighbor cells) to the neighbor accumulated cost, to create the accumulated cost of the target cell. If the neighbor is diagonal, the local cost is multiplied by
## The algorithm must also take into account that indirect routes may have lower cost, often using a hash table
In computing, a hash table, also known as hash map, is a data structure that implements an associative array or dictionary. It is an abstract data type that maps keys to values. A hash table uses a hash function to compute an ''index'', als ...
to keep track of temporary cost values along the expanding fringe of computation that can be reconsidered.
## Repeat the procedure until all cells are assigned.
# Drain: In keeping with the terrain analogy, trace the optimal route from the given destination back to the source like a stream draining away from a location. At its most basic, this is accomplished by starting at the destination cell, moving in the direction indicated in the backlink grid, then repeating for the next cell, and so on until the source is reached. Recent software adds some improvements, such as looking across three or more cells to recognize straight lines at angles other than the eight neighbor directions. For example, th
r.walk
function in GRASS can recognize the "knight's move" (one cell straight, then one cell diagonal) and draw a straight line bypassing the middle cell.
Corridor analysis
A slightly different version of the least-cost path problem, which could be considered a fuzzy version of it, is to look for ''corridors'' more than one cell in width, thus providing some flexibility in applying the results. Corridors are commonly used in transportation planning and in wildlife management.
The solution to this problem is to compute, for every cell in the study space, the total accumulated cost of the optimal path between a given source and destination that passes through that cell. Thus, every cell in the optimal path derived above would have the same minimum value. Cells near this path would be reached by paths deviating only slightly from the optimal path, so they would have relatively low cost values, collectively forming a corridor with fuzzy edges as more distant cells have increasing cost values.
The algorithm to derive this corridor field is created by generating two cost accumulation grids: one using the source as described above. Then the algorithm is repeated, but using the destination as the source. Then these two grids are added using map algebra
Map algebra is an algebra for manipulating geographic data, primarily Field (geography) , fields. Developed by Dr. Dana Tomlin and others in the late 1970s, it is a set of primitive operations in a geographic information system (GIS) which allows ...
. This works because for each cell, the optimal source-destination path passing through that cell is the optimal path from that cell to the source, added to the optimal path from that cell to the destination. This can be accomplished using the cost accumulation tool above, along with a map algebra tool, although ArcGIS
ArcGIS is a family of client, server and online geographic information system (GIS) software developed and maintained by Esri. ArcGIS was first released in 1999 and originally was released as ARC/INFO, a command line based GIS system for manipula ...
provides
Corridor
tool that automates the process.
Cost-based allocation
Another use of the cost accumulation algorithm is to partition space among multiple sources, with each cell assigned to the source it can reach with the lowest cost, creating a series of regions in which each source is the "nearest". In the terrain analogy, these would correspond to watersheds (one could thus call these "cost-sheds," but this term is not in common usage). They are directly related to a voronoi diagram
In mathematics, a Voronoi diagram is a partition of a plane into regions close to each of a given set of objects. In the simplest case, these objects are just finitely many points in the plane (called seeds, sites, or generators). For each seed th ...
, which is essentially an allocation over a space with constant cost. They are also conceptually (if not computationally) similar to location-allocation Location-allocation refers to algorithms used primarily in a geographic information system to determine an optimal location for one or more facilities that will service demand from a given set of points. Algorithms can assign those demand points t ...
tools for network analysis.
A cost-based allocation can be created using two methods. The first is to use a modified version of the cost accumulation algorithm, which substitutes the backlink grid for an allocation grid, in which each cell is assigned the same source identifier of its lowest-cost neighbor, causing the domain of each source to gradually grow until they meet each other. This is the approach taken in ArcGIS Pro
ArcGIS Pro is desktop GIS software developed by Esri, which replaces their ArcMap software generation. The product was announced as part of Esri's ArcGIS 10.3 release, ArcGIS Pro is notable in having a 64 bit architecture, combined 2-D, 3-D suppor ...
. The second solution is to first run the basic accumulation algorithm, then use the backlink grid to determine the source into which each cell "flows." GRASS GIS uses this approach; in fact, the same tool is used as for computing watersheds from terrain.
Implementations
Cost distance tools are available in most raster GIS software:
* GRASS GIS
''Geographic Resources Analysis Support System'' (commonly termed ''GRASS GIS'') is a geographic information system (GIS) software suite used for geospatial data management and analysis, image processing, producing graphics and maps, spatial and ...
(often bundled into QGIS
QGIS is a free and open-source cross-platform desktop geographic information system (GIS) application that supports viewing, editing, printing, and analysis of geospatial data.
Functionality
QGIS functions as geographic information system (GIS ...
), with separate accumulation
r.cost
and drain
functions
* ArcGIS Desktop and ArcGIS Pro
ArcGIS Pro is desktop GIS software developed by Esri, which replaces their ArcMap software generation. The product was announced as part of Esri's ArcGIS 10.3 release, ArcGIS Pro is notable in having a 64 bit architecture, combined 2-D, 3-D suppor ...
, with separate accumulation
Cost Distance
and drain
geoprocessing tools, as well a
generation. Recently, starting with ArcGIS Pro version 2.5, a new set of cost distance tools was introduced, using more advanced algorithms with more flexible options.
* TerrSet
TerrSet (formerly IDRISI) is an integrated geographic information system (GIS) and remote sensing software developed by Clark Labs at Clark University for the analysis and display of digital geospatial information. TerrSet is a PC grid-based syste ...
(formerly Idrisi) has several tools, implementing a variety of algorithms to solve different kinds of cost distance problems, including anisotropic (directional) cost.[Eastman, J. Ronald]
TerrSet Manual
p.115, 227, 356
References
{{Reflist
External links
documentation for Esri ArcGIS Pro
tools in GRASS GIS
Geographic information systems