ArcGIS Pro 2.5: What is the mathematical formula based on which the “cost distance” is calculated?

2493
13
Jump to solution
06-23-2020 10:06 PM
JamalNUMAN
Legendary Contributor

ArcGIS Pro 2.5: What is the mathematical formula based on which the “cost distance” is calculated at any cell?

 

For example, in the screenshot below, the “cost distance” at the cell number “152” is “144.85”. in return, the value of the “cost distance” at the cell number “148” is “120” which equals the value of “Euclidean distance” at that cell.

 

What is the mathematical formula based on which the “cost distance” of a cell is derived from “cost raster” and “Euclidean distance” of that cell?

 

For simplicity, all the cells of “cost raster” is made to have the value one. I observed that the equation below is valid to calculate the “cost distance” at some cells (but not all):

 

Cost Distance = Cost Raster * Euclidean Distance

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Jamal:

a cost raster cannot have cells with zeros. The outputs will not be valid.

cost distance computes network distance (sum of edge weights) over a set of network nodes and edges. The input cost raster is used to assign weights to those edges. A zero weight on an edge means you could travel over that edge as many times as you wanted without increasing your cost, so your shortest path through a set of zero valued edges is not defined. One way to think of a zero weight is that it means you could be in multiple locations at the same time.

The backlink raster records the set of directions you must follow when you start from an arbitrary location and want to use the shortest path to get back to the source.

As i explained above, euclidean distance will equal cost distance when you travel in certain directions, as is the case with cell 46 in your example.

View solution in original post

13 Replies
DanPatterson
MVP Esteemed Contributor

How cost distance tools work—Help | Documentation 

look at the formula for Adjacent and Diagonal.


... sort of retired...
JamalNUMAN
Legendary Contributor

I reviewed the methods provided in the document but appears not to solve the issue.

 

For example, consider the “cost raster” of cells (30x30 meter) that have a value of 1, then how come the upper right corner cell of the “cost distance” to have the same value as the “Euclidean distance” as shown in the screenshot below?

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
by Anonymous User
Not applicable

Jamal:

What value were you expecting in the upper right corner cell?

Keep in mind that your source ("A") is going to first get moved to a cost cell center. Judging from your result, A is getting moved to the center of its NE neighbor.

As Dan's link explains, the cost distance algorithm computes shortest distance on a network.That will happen to be the same as euclidean distance when the shortest network path and the shortest euclidean path coincide. That coincidence happens when your euclidean destination lies along one of the allowed directions of travel from the source imposed by the cost distance network.

At arcgis pro 2.5, we've introduced a new set of distance tools: DistanceAccumulation, DistanceAllocation, and OptimalPathAsLine, which compute true shortest weighted euclidean distances and paths over a cost surface. If you try those tools, you should see that DistanceAccumulation with a cost surface of '1's produces substantially the same result as EuclideanDistance in all directions moving away from the source (there are some small differences, closer to source cells, which become less as you move away from the sources).

Regards,

James TenBrink

JamalNUMAN
Legendary Contributor

Thank you very much Jim for the help and elaboration

 

All what I wanted here is find the relation between the cell value of cost distance and its corresponding value of Euclidean distance and (may be the back link)

 

Is the cost distance a function of Euclidean distance? The formula below appears not to work

 

CDi = CRi * EDi

 

Where:

CDi: cost distance value at the ith cell

CRi: cost raster value at the ith cell

EDi: Euclidean distance at the ith cell

 

To simplify the calculations, all the cells of the cost raster take value of 1. The cell size is 30x30.

 

Now, in the screenshot below, the values below are observed for the cell # 82

Euclidian distance = 161

Cost Raster  = 174

 

How this can be explained?

 

I’m attaching the layers below:

 

The source point

Polygon layer to number the cells

Polygon layer to derive the cost raster (all cells has a value of 1)

Study area

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
by Anonymous User
Not applicable

Jamal

> Is the cost distance a function of Euclidean distance?

no, its not.

Please carefully reread the link that Dan posted and my follow-on response. As i said, cost distance tool computes network distance which is only the same as euclidean distance in certain directions.

the network, in this case, is implicitly constructed as follows: place a node on each cell center, add edges between a given node and its 8 adjacent neighbors. Cost distance then essentially runs a network shortest path algorithm from the set of source nodes to all other nodes.

In the image below, the euclidean distance between the two marked cell centers is in green, while the cost distance path is marked in red. Cost distance will report a longer path because it cannot follow the best direction between the cell centers.

by Anonymous User
Not applicable

i suppose that saying its not a function is an over-simplification. This early paper by Dr. Michael Goodchild discusses, among other things, the error in the network length as a function of the difference between the exit angles.

JamalNUMAN
Legendary Contributor

Thanks Jim.

 

But how the “cost raster” affects the “cost distance” and “back link”? is the “back link” dependent on the “cost raster”?

 

Considering the useful elaboration you have already provided, in case all the cells of the “cost raster” are zeroes, this means that the “cost distance” is the straight line between each cell’s center to the source point. This also should lead to the fact that that the “Euclidean distance” = “Cost distance” in case the “cost raster” is zero. Then the “cost distance” can be seen as the distance that respects the “cost raster”

 

Am I right?

 

For cell#46 below, Euclidean distance” = “Cost distance”, “Cost raster” = 1. How this can be explained?

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
by Anonymous User
Not applicable

Jamal:

a cost raster cannot have cells with zeros. The outputs will not be valid.

cost distance computes network distance (sum of edge weights) over a set of network nodes and edges. The input cost raster is used to assign weights to those edges. A zero weight on an edge means you could travel over that edge as many times as you wanted without increasing your cost, so your shortest path through a set of zero valued edges is not defined. One way to think of a zero weight is that it means you could be in multiple locations at the same time.

The backlink raster records the set of directions you must follow when you start from an arbitrary location and want to use the shortest path to get back to the source.

As i explained above, euclidean distance will equal cost distance when you travel in certain directions, as is the case with cell 46 in your example.

JamalNUMAN
Legendary Contributor

Thank you for the valuable input.

 

Assume that it is required to find the optimal route between two points (source and destination) that considers the factors below:

 

The lower the slope the better

The far from dense urban areas the better

The far from olive trees the better

 

These three factors are combined to produce the cost raster that ranges from 1-9. Then how does this cost raster affect specify the cost distance?

 

As I understand, the values of cells of “cost distance” will be high where the cells of cost raster are high.

 

Is this correct?

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine