Available with Image Server

Distance analysis is fundamental to most GIS applications. In its simplest form, distance is a measure of how far away one thing is from another. A straight line is the shortest possible measure of the distance between two locations. However, there are other things to consider. For example, if there is a barrier in the way, you have to detour around it, which increases the total distance to get from one location to another. Another consideration is the texture of the surface, which can increase the actual distance travelled if the terrain changes from flat ground to rough terrain. There are many other factors that can influence the effort required to get from a starting point to an end point. Some of these factors include the steepness of the terrain, whether you will be moving with the wind or against it, the mode of transportation, and the types of land cover being traversed. There is also a difference in distance measure if the calculations are done using a planar or a geodesic method.

The Spatial Analyst extension provides tools you can use to calculate distance for a range of scenarios. The tools have several parameters that you can use to apply various modifiers to the operation. As a result, you generate more accurate output that you can use to make better analytical decisions.

Distance analysis can be divided into two main tasks:

- Calculate the distance to the closest or cheapest source.
- Connect a series of locations with optimal paths over a distance surface.

## Calculate distance

There are two aspects to consider when calculating distance:

- Determine how far away something is.
- Once that distance is determined, define how that distance is encountered by a traveler.

### Determine how far away something is

Determining how far away one thing is from another is the basic element of calculating distance. It is the straight-line or Euclidean distance between two points. For additional information, see Calculate straight-line distance.

However, there are other factors that can alter the straight-line distance calculation including barriers and surface distance.

A barrier, such as a river, cliff, highway, or building, is something that prevents you from traveling directly from one location to another. Since detouring around the barrier means it will be farther to travel, you may want to know the shortest possible distance. For use cases and additional information, see Account for barriers in distance calculations.

The surface distance is the actual distance on the ground that must be traveled when moving over the landscape. Compared to the straight-line distance, the surface distance is farther when accounting for the up and down undulations of the actual ground surface. For use cases and additional information, see Account for surface in distance calculations.

### Distance encountered by a traveler

How distance is encountered by a traveler is often the interaction that is of interest. There is always an implied traveler. That traveler can be a living entity such as a person or an animal. In an abstract form, it can be an inanimate object such as a pipeline or road. That is, when constructing the pipeline or road, various landscape features are encountered within each cell, such as flat and steep slopes, forests, and wetlands. When calculating the basic straight-line distance, the traveler can be thought of as a bird or airplane flying low over the ground in calm air, unaffected by conditions on the surface.

There are multiple factors that influence how a traveler encounters the distance. Each affects the rate at which the distances are consumed. The following factors can be used to control the rate at which distance is encountered:

- Cost surface
- Characteristics of the traveler from the source
- Vertical factor
- Horizontal factor

#### Cost surface

For each cell, a cost surface identifies how the features at the location affect the movement through the cell. It is the cost to the traveler to move through the location. The lower the defined cost for a cell, the easier the movement. For example, a hiker can move quickly and easily through an open field, but muddy ground in a thick forest will slow them down, making them use more energy and it will take longer to travel each distance unit. For use cases and additional information about how the cost surface affects how distances are encountered, see Adjust the encountered distance using a cost surface.

The distance is measured as a rate of cost. Because of the cost surface, the cost distances do not radiate equally from each source as they do in the straight-line distance result.

#### Characteristics of the traveler from the source

The characteristics of the traveler can modify how distance is encountered. The following characteristics of the traveler can alter how the rate distance is encountered:

- Mode of travel—This is applied as a multiplier and can define the means of transportation. For example, it can capture whether the traveler is moving by foot or ATV. It can also account for the number of travelers. In both cases, the mode modifies how fast distances can be covered.
- Starting cost—This can be used, for example, to capture the time it takes to prepare the ATV.
- Maximum capacity—This can identify, for example, the distance or cost before the ATV runs out of gas.
- Travel direction—This can capture, for example, if a deer is moving toward a stream or away from it.

For use cases and additional information about how the characteristics of the traveler affects how distances are experienced, see Adjust the encountered distance using source characteristics.

#### Vertical factor

Use the Vertical factor parameter to account for the effort a traveler must exert to overcome the slopes they encounter. Going directly uphill takes more effort and slows down the traveler. As a result, it takes longer to cover that particular distance. It may be easier to cover the same distance when going downhill, and going across a slope is somewhere in between. The travel direction characteristic described in the previous section in conjunction with the vertical factor will affect how the slopes are encountered. Moving away from or toward a source can produce different results.

To reinforce the distinction between the surface distance described above and the vertical factor, the vertical factor modifies how the distance is encountered based on the effort to overcome the slopes, while the surface distance adjusts for the actual distance traveled based on the undulations of the surface. For use cases and additional information, see Adjust the encountered distance using a vertical factor.

#### Horizontal factor

Use the Horizontal factor parameter to account for the impact on distance when the traveler encounters horizontal influences, such as wind or ocean current. For example, if the traveler is a boat and it is moving with the wind or current, it moves through distances at a faster rate. However, if it is moving into the wind or current, it will take longer to travel the distance. If the boat encounters the wind or current at an angle, there may not be much affect. For example, the horizontal factor is evident when traveling west to east from Los Angeles to New York City in an airplane versus east to west. It takes less time to fly west to east due to the influence of the prevailing wind—the airplane can cover more distance at a faster rate. For use cases and additional information, see Adjust the encountered distance using a horizontal factor.

### Planar and geodesic methods affect distance calculations

The distance can vary depending on whether you are calculating in a planar or geodesic spatial reference system. If you are calculating in a planar method, the distance can vary based on how far the distance calculations are being measured, where in the world the calculations are being made, and the specified projection. Calculating distance in a geodesic method always results in the true ground distance regardless of where you are in the world or how far apart the locations are. For additional information, see Geodesic versus planar distance.

### Distance accumulation analytical sequence

The Distance Accumulation tool incorporate the adjustments to the straight-line distance calculations and define the rate the distance is encountered through a series of modifying parameters. You progress sequentially through the parameters in the tool and populate those that are relevant to your analysis. Through the series of modifying parameters, you can capture most scenarios for calculating the distance and determining the rate that distance will be encountered. Those modification possibilities are described below.

#### Calculate the distance

For the Input raster or feature source data parameter, identify the locations from which the distance will be determined.

To adjust the straight-line distance to account for an obstacle or barrier, identify them in the Input barrier raster or feature data parameter.

To adjust the straight-line distance to account for the actual surface distance that is traveled, provide an elevation surface in the Input surface raster parameter

#### Define the rate at which the distance is encountered

To simulate a traveler moving through the landscape, identify what the traveler will encounter. Provide a cost surface in the Input cost raster parameter.

To define unique aspects of the traveler, expand the Characteristics of the source category to see the available options.

- To set a starting distance or cost that is incurred before moving, specify it in the Initial accumulation parameter.
- To set a limit to the amount of distance or cost that can be endured, specify it in the Maximum accumulation parameter.
- To set a mode of transportation that alters the rate at which the distance is overcome, specify a multiplier in the Multiplier to apply to costs parameter.
- To set the direction of movement of the traveler, either away from or toward the source, specify the direction in the Travel direction parameter.

To account for the effort to overcome the slopes encountered, expand the Costs relative to vertical movement parameter, provide an elevation surface for Input vertical factor, and specify a vertical factor.

To account for the horizontal influences encountered, such as wind or current, expand the Costs relative to horizontal movement parameter, provide a raster for Input horizontal factor, and specify a horizontal factor.

#### Define the surface model

To account for the actual shape of the earth as an ellipsoid, set the Distance method parameter to Geodesic. The calculations for the default Planar flat-earth method are performed on a projected flat plane using a 2D Cartesian coordinate system. For the Geodesic setting, the calculations are performed in a 3D Cartesian coordinate system that produces a more accurate result, but may increase the processing time.

### Distance Allocation tool

The Distance Accumulation tool outputs a distance accumulation raster and, optionally, back direction, source direction, and source location rasters. The Distance Allocation tool includes the same parameters and can create the same output rasters as the Distance Accumulation tool, but it also outputs a distance allocation raster.

The distance accumulation raster calculates the accumulative distance to the closest or least-cost source. The back direction raster indicates the direction to travel from each cell to return to the closest or least-cost source. The source direction raster determines the direction to the closest or least-cost source. The source location raster identifies the row and column of the closest or least-cost source. For each cell, the distance allocation raster identifies the closest or least-cost source to reach.

### Legacy cost distance tools

Prior to ArcGIS Pro 2.5, it was necessary to have a series of tools to capture the various distance modifiers because of the way distance was calculated. Euclidean or straight-line distance was calculated directly between the destination cell center to the source cell center. Cost distance analysis required separate tools because cost distance measures network distance along a sequence of edges constructed between adjacent cells. The Distance Accumulation and Distance Allocation tools can calculate straight-line and cost distance and all their variations. For additional information about the underlying algorithm, and how straight-line and cost distance can now be performed in a single tool, see How distance accumulation works.

## Connect locations over a distance surface

While it is useful to know how far away something is, you may also want to know the best way to connect a series of locations either by shortest paths or by paths that incur the least possible cost. There are three main scenarios for connecting locations:

- You have a series of locations you want to connect. You want a network of paths to connect them in the optimal—shortest or least cost—way.
- You want specific locations to be connected to other specific locations with optimal paths.
- You want specific locations to be connected to other specific locations with an optimal corridor.

### Connect a set of locations using optimum connections

Use the Optimal Region Connections tool to connect a series of locations or regions with the shortest or least-cost network of paths. With this tool, it doesn't matter which regions are connected to which. You want them to be connected in the shortest or least-cost way possible. To do this, you specify the locations or regions to connect and, optionally, a cost surface. In the resulting network of paths, you can reach any location from any other location, although you may need to pass through a location to reach a distant location.

For use cases and additional information, see Connect regions with the optimal network.

### Connect specific locations by paths

In this scenario, you want to connect specific locations to other specific locations. This is a two-step process. First, you run the Distance Accumulation tool using the specific locations you want to connect to the other specific locations. You need to generate two outputs from the tool, an accumulation distance raster and a back-direction raster. For the second step, use the two rasters just created along with the other specific locations you want to connect as inputs to either the Optimal Path as Line or Optimal Path As Raster tool. The tools trace back a path from the other specific locations to the initial locations using the back-direction raster. The difference between the two tools is that one returns the resulting optimal paths as a line feature; the other returns them as a raster.

For use cases and additional information, see Connect locations with optimal paths.

### Connect specific locations by a corridor

This scenario is similar to the paths scenario in which you want to connect specific locations to other specific locations. However, instead of connecting the locations with linear paths, in these scenarios, they are connected by a corridor. The width of the corridor at any point is based on cost. It is not a simple Euclidean buffer around the connecting paths. To create the corridor, first run Distance Accumulation on the specific initial location. Then run the tool on the other specific location you want to connect to. Next, use the resulting accumulation distance rasters and back direction rasters as input to the Least Cost Corridor tool. To define the width of the corridor, apply a threshold either as a percent of the minimum value of the summed accumulative cost distance rasters or by a specified accumulative cost.