# Understanding Euclidean distance analysis

The Euclidean distance tools describe each cell's relationship to a source or a set of sources based on the straight-line distance.

There are three Euclidean tools:

- Euclidean Distance gives the distance from each cell in the raster to the closest source.
Example of usage: What is the distance to the closest town?

- Euclidean Direction gives the direction from each cell to the closest source.
Example of usage: What is the direction to the closest town?

- Euclidean Allocation identifies the cells that are to be allocated to a source based on closest proximity.
Example of usage: What is the closest town?

## The source

The source identifies the location of the objects of interest, such as wells, shopping malls, roads, and forest stands. If the source is a raster, it must contain only the values of the source cells, while other cells must be NoData. If the source is a feature, it will internally be transformed into a raster when you run the tool.

## The Euclidean distance algorithm

Euclidean distance is calculated from the center of the source cell to the center of each of the surrounding cells. True Euclidean distance is calculated in each of the distance tools. Conceptually, the Euclidean algorithm works as follows: for each 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 Euclidean distance, rather than the cell distance. The shortest distance to a source is determined, and if it is less than the specified maximum distance, the value is assigned to the cell location on the output raster.

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

The above description is only a conceptual depiction of how values are derived. The actual algorithm computes the information using a two-scan sequential process. This process makes the speed of the tool independent from the number of source cells, the distribution of the source cells, and the maximum distance specified. The only factor that influences the speed with which the tool executes is the size of the raster. The computation time is linearly proportional to the number of cells in the Analysis window.

## The Euclidean distance output raster

The Euclidean distance output raster contains the measured distance from every cell to the nearest source. The distances are measured as the crow flies (Euclidean distance) in the projection units of the raster, such as feet or meters, and are computed from cell center to cell center.

The Euclidean Distance tool is used frequently as a stand-alone tool for applications, such as finding the nearest hospital for an emergency helicopter flight. Alternatively, this tool can be used when creating a suitability map, when data representing the distance from a certain object is needed.

In the example below, the distance to each town is identified. This type of information could be extremely useful for planning a hiking trip. You may want to stay within a certain distance of a town in case of emergency or know how much farther you have to travel to pick up supplies.

## The Euclidean direction output raster

The Euclidean direction output raster contains the azimuth direction from each cell to the nearest source. Euclidean direction assigns the direction of each cell in degrees to its nearest source. A 360-degree circle or compass is used, with 360 being to the north and 1 to the east; the remaining values increase clockwise. The value 0 is reserved for the source cells.

In the example below, the direction to the nearest town is found from every location. This could provide useful information for an emergency helicopter when transporting an injured hiker to the nearest town for medical treatment.

## The Euclidean allocation output raster

Every cell in the Euclidean allocation output raster is assigned the value of the source to which it is closest, as determined by the Euclidean distance algorithm.

Each cell in an allocation receives the value of the zone to which it will be allocated. A source is any cell or set of cells with the same value or belonging to the same zone. If a zone is disconnected, the value assigned to the cells allocated to that zone is the distance of the closest region of the zone.

If this is not the desired result (having the same output values for cells allocated to regions that may spatially be far apart), use the Region Group tool of the Generalize tools on the source data, which will assign new values for each connected region. Alternatively, the input value raster can be used if unique values exist for these regions.

The values for all non-source cells on the output raster will contain the same values assigned to the cells in the source raster or the values associated with each source location derived from the value raster.

Use this tool to assign space to objects such as identifying the customers served by a group of stores. In the example below, the Euclidean Allocation tool has identified the town that is closest to each cell. This could be valuable information if you needed to get to the nearest town from a remote location.

## Limitations of Euclidean distance

The Euclidean distance tools give you information according to Euclidean, or straight-line, distance. It may not be possible to travel in a straight line to a specific location; you may have to avoid obstacles such as a river or a steep slope. In such cases, you should consider using the Cost distance tools to achieve more realistic results.