Account for surface in distance calculations

Available with Spatial Analyst license.

Straight-line distance can be altered when a barrier is present and when a surface raster is specified. A surface raster incorporates the actual distance encountered adjusting for the ups and downs in the landscape surface. Once the adjusted straight-line distance is identified, the rate that distance is encountered by a traveler can be determined. The adjusted straight-line distance must be accurate to capture the true movement of the traveler.

The basic straight-line distance without a surface raster or barrier applied theoretically models the traveler as if it were flying just above the surface. When the landscape surface is incorporated in the distance calculations, it accounts for the additional distance the traveler will cover because they are moving over the undulations in the landscape. The landscape surface is identified by a surface raster and is typically an elevation surface.

A hiker walking over a hill takes more steps than walking on flat ground
Straight line distance versus surface distance.

The image below illustrates how the general calculations are performed. Since the route from point A to point B is uphill, the traveler needs to travel farther than if the route were flat. The distance that would be traveled is referred to as the surface distance.

Hiker walking up a slope is taking more steps than if on flat ground
A hiker walking up a slope takes more steps than if on flat ground.

Unless the cell is flat, the surface raster will always increase the distance to move through it.

The rate at which the adjusted distance is encountered can be controlled by a cost surface, the source characteristics, a vertical factor and a horizontal factor. If any of these factors are specified, the distance to move through a cell (adjusted for the surface raster) is multiplied by the cost associated with the cell.

The surface distance is not to be confused with the vertical factor. The surface distance increases the actual distance the traveler will travel. The vertical factor is the effort to overcome the slopes the traveler encounters when moving over the landscape.

Surface raster use examples

A surface raster can be used to help solve various scenarios, such as the following:

  • Determine how much water will be required to protect a neighborhood in a mountainous area from an advancing brush fire when you need to spray a 500-meter straight-line protection buffer around the houses. It is necessary to determine the actual surface area that needs to be covered.
  • Determine the actual distance that must be traveled by rescuers to reach an injured hiker.
  • Determine the number of steps you will register on your fitness tracker when you go for a run.

Adjust straight-line distance analysis with a surface raster

Distance analysis can be divided conceptually into the following related functional areas:

From the first functional area, the straight-line distance is adjusted with a surface raster as illustrated below. The scenario involves a collection of four forest ranger stations (purple dots), and some rivers (blue lines).

Map of straight-line distance being adjusted to move around streams which are barriers
Straight-line distance map adjusting for barriers. The rangers cannot traverse the rivers so the rivers act as barriers. Notice the distances increases on the other side of the barriers.

When also adjusting the straight-line distance for the surface distance, there are only slight spatial changes in the overall raster, but the range of the values does change.

Map of straight-line distance adjusting for barriers and the surface distance
The distance map is adjusted for the actual surface distance that is traveled. An elevation surface was entered as the surface raster. Notice in the legend, the distance values are greater.

Create an accumulative distance raster that adjusts for the surface

To create an accumulative distance map that incorporates the actual surface distance, complete the following steps:

  1. Open the Distance Accumulation tool.
  2. Provide the source in the Input raster or feature source data parameter.
  3. Name the output distance raster.
  4. Identify the surface raster in the Input surface raster parameter.
  5. Specify any other necessary parameters.
  6. Click Run.

Surface raster affects distance calculation

The input surface raster is used to determine the actual surface distance traveled from one cell to the next. The surface distance is an adjustment to the straight-line distance. Elevation data is often used as the input surface raster.

When locating a new building complex, the closer the building is to existing power lines, the better. In the following image, the distance to the closest power line (blue lines) is identified for each cell. The more green a cell is, the closer it is to a power line. The distance was calculated with a barrier, the ridge line (the purple line), but without specifying a surface raster.

Map of straight-line distance being adjusted to move around the ridge barrier
The straight-line distance is adjusted to account for the additional distance necessary to move around the ridge (the barrier).

In the following image, that same distance is calculated, but this time with a surface raster input specified. The two maps appear similar but the ranges are different in their legends. The surface distance increases the overall distance that must be traveled.

Map of straight-line distance being adjusted with barriers and a surface raster
The straight-line distance is adjusted for barriers and a surface raster. The map looks very similar to the map above with just barriers, but the range has increased.

If the landscape is not flat, the accumulative distance is always greater when a surface raster is provided. When one or multiple rate controlling factors—a cost surface, source characteristic, vertical factor, or horizontal factor—are also provided, greater distance means that more cost is incurred at the rate determined by these factors.

The surface raster can affect the output back-direction, source direction and distance allocation rasters when calculating straight-line distance, particularly in rugged terrain. When a cost surface, vertical factor, horizontal factor, and source characteristic input are provided, these three outputs may change depending on the undulations and their steepness in the surface raster and the variation in the cost surface. Steep locations have a greater surface distance, and if the location has high cost, the final output accumulative distance and accompanying values may increase significantly.

Often the same elevation raster that is used for the surface raster is also used as the vertical factor raster.

Additional applications incorporating a surface raster

The following are sample applications in which straight-line distance is adjusted to account for the surface distance to address specific problems.

Identify the shortest surface distance

To calculate the shortest surface distance between two points, use one of the points as the input to Distance Accumulation, along with an elevation surface for the Input surface raster parameter. Use the accumulative distance and back direction outputs, along with the second point, as inputs to the Optimal Path As Line tool. The generated path will be the shortest surface distance back to the first point.

Calculate distances along a network

Using the Distance Accumulation tool with a surface raster, you can calculate the surface distance along a network from a set of locations on that network. This can be useful, for example, to calculate the distance along streams upstream from stream gauges or the distance along roads from bus stops. The stream gauges or bus stops are provided as the sources and an elevation surface is provided for the Input surface raster parameter. The network over which the distance is to be computed is provided for the Input cost raster parameter. The cost raster will have a value of 1 assigned to all cells on the network and NoData to all cells that are not on the network.

To obtain more accurate results, set a smaller cell size when you rasterize the network to create the cost surface. Then apply a thickening operator to the rasterized versions of the network features. Focal Statistics is a good way to thicken a raster representing a linear network. It widens the paths in the raster network while generally preserving the individual cell values on the network.

Map of distance calculations along a stream network from a stream gauge
The distance along rivers from the stream gauge located at the upper left (cyan dot) is shown.

Calculate actual travel distance between cells

The tool applies the Pythagorean theorem to calculate the actual travel distance between two cells. The Pythagorean theorem calculates the actual surface distance as the hypotenuse of the distance between the cells and the difference in elevation.

Right angle triangle showing how the hypotenuse is calculated
Actual travel distance is calculated by the Pythagorean theorem as the hypotenuse (c) of a right-angle triangle with the base (a) as the distance between the cells and the height (b) as the difference in elevation.

If the cost distance is being calculated to one of the four adjacent neighbors, the length of the base (a) is equal to the cell size (the distance from the center of one cell to the center of another). If the cost distance is being determined to a diagonal cell, the base is derived from the cell size times approximately 1.414214 (or, √2). To determine the height (b) of the triangle, the height of the first cell on the surface raster is subtracted from the height of the second cell.

This is a conceptual description of the calculations. For detailed information, see Distance accumulation algorithm.


The linear x and y units of the input data must be the same as the horizontal units. Be careful when using a surface raster that is in decimal degrees. If the input surface raster has a vertical coordinate system, the tool makes all the units the same. If there is no vertical coordinate system associated with the surface raster, it is assumed that the surface units are the same as the horizontal units. The inputs can be in degrees in a geographic coordinate system when using the Geodesic method.

Related topics