Calculate straight-line distance

Available with Image Server

Straight-line Euclidean distance is the distance that typically comes to mind when you think of distance analysis. It is the shortest distance between two points.

Straight-line distance is the distance that you measure with a ruler on a paper map. Straight-line distance does not account for the surface between the two points. It is the distance a bird or airplane would travel between the two points when flying above the surface.

Distance Accumulation is the primary tool for calculating straight-line distance. In its simplest form, you only need to specify the source locations. For each nonsource cell, the tool will calculate the straight-line distance to the closest source location.

Two points on a surface connected with a straight line

Straight-line distance can be altered when a barrier is present. Another way straight-line distance can be altered is when incorporating the actual distance encountered when accounting for the ups and downs in the surface.

Straight-line distance analysis examples

Straight-line distance is one of the most common distance calculations and it addresses a wide range of applications such as the following:

  • A planning department is determining if a proposed housing development is within the legal buffer of a wetland.
  • In a deer suitability model, calculate how far each location is from a stream so the resulting distance surface can be used as an input criterion.
  • In a helicopter rescue of an injured hiker, determine the closest hospital.
  • During an oil spill, identify all bird nesting sites within 5,000 meters of the spill.
  • A simple airport noise model may use distance from runway as an intermediate step.

Straight-line distance analysis

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

From the first functional area, the straight-line distance calculations are illustrated in the images below. The scenario involves a collection of four forest ranger stations (purple dots), and some rivers (blue lines).

Map of straight-line distance from four points
The straight-line distance from each non-source cell to the closest ranger station (purple points). Rivers are displayed (blue lines)

The straight-line direction to the closest ranger station can also be determined as shown in the image below.

Map of straight-line direction from four points
The straight-line direction from each non-source cell to the closest ranger station. The directions are based on compass directions (0 to 360.

Create a straight-line distance raster

To create a straight-line distance raster, complete the following steps:

  1. Open the Distance Accumulation tool.
  2. Provide the sources that you want to calculate the distance to in the Input raster or feature source data parameter.
  3. Name the output distance accumulation raster.
  4. Click Run.

Straight-line distance calculation and output

The following sections provide the basic information you need to make informed decisions when calculating straight-line distance using the Distance Accumulation tool.

Input sources

The input sources identifies the locations to which distance will be calculated. Example sources include roads, streams, town centers, bird nesting sites, and wetlands. If the source input is a raster, it must contain only the values of the source cells, and other cells must be NoData. If the source input is a feature class, it will be converted to a raster when the tool is run.

Calculations

The straight-line distance is calculated from each nonsource cell center to the center of each source cell. Each nonsource cell is assigned the shortest distance to a source.

Conceptually, the algorithm works as follows: for each nonsource cell, the distance to each source cell is determined by calculating the hypotenuse with x_max and y_max as the other two legs of the triangle. This calculation derives the true straight-line Euclidean distance rather than determining the network distance along a sequence of edges constructed between adjacent cells. Once the shortest distance to a source is determined, if it is less than the specified maximum distance, that value is assigned to the cell location on the output raster. If a maximum distance is specified, any nonsource cell that is farther than that distance will receive NoData.

Straight-line distance between a source cell and a nonsource cell

The output values for the distance raster are floating-point values. If a cell is at an equal distance from two or more sources, the cell is assigned to the source that is first encountered in the scanning process.

The above description is a conceptual depiction of how values are derived. The actual algorithm computes the information using a two-scan sequential process. The processing time depends on the total number of cells in the analysis window, not the number of source cells or how the source cells are arranged.

Straight-line distance output

Multiple output rasters can be created from the Distance Accumulation tool. When calculating straight-line distance, the meaning of the resulting output values are described below.

Distance accumulation output raster

The straight-line distance accumulation output raster records the measured distance from every nonsource cell to the closest source. The units of the distance values recorded are the linear units, such as feet or meters based on the output spatial reference.

Back-direction output raster

This raster identifies the travel direction out of a cell, en route to its nearest source cell along the shortest path. If a barrier has been specified, this direction may not be the same as the straight-line direction to that cell.

The back-direction raster provides per-cell travel directions. The range of values is from 0 degrees to 360 degrees, with 0 reserved for the source cells. Due east, to the right, is 90, and the values increase clockwise, so that 180 is south, 270 is west, and 360 is north.

An important use of the back-direction raster is determining the shortest path between two locations. The distance accumulation and back-direction rasters are required inputs to the Optimal Path as Line and Optimal Path as Raster tools.

Source direction output raster

The source direction raster identifies the direction of the nearest source cell as an azimuth in degrees.

It uses the same angle convention as the back-direction raster but integer values are assigned instead of floating point. Other than the output type, if no barriers are identified, the source direction and back-direction rasters produce the same results.

Distance allocation and straight-line distance

A related tool to the Distance Accumulation tool is the Distance Allocation tool. All the parameters and the outputs are the same, except that the Distance Allocation tool also outputs an allocation raster. For each cell, this raster indicates the closest source for that cell to reach.