Select to view content in your preferred language

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

2706
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
13 Replies
by Anonymous User
Not applicable

> 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?

Those input cost cell values become the edge weights on a network. The cell values in the output accumulative cost distance raster are the minimal sum of edge weights required to reach an accum cost cell.

> the values of cells of “cost distance” will be high where the cells of cost raster are high.

Its ok to think of it like that, but its better to say:

"the values of cells of (accumulative) cost distance will be the lowest possible sum of input cost cells required to reach the accum cost distance cell."

This is more precise because you can always increase your accum cost by choosing a less efficient network path , but you can't decrease it (following any path).

I want to mention again that at 2.5 there are new tools, Distance Accumulation and Distance Allocation, which you should consider using instead of Cost Distance. The inputs to these new tools are prepared the same way as for Cost Distance but they do not have the network distortion effect that we've been discussing here, so when you use a constant input cost raster of value '1', your output will be the same (mostly) as the euclidean distance output.

JamalNUMAN
Legendary Contributor

Much more clearer now.

 

I’m not able to manually calculate the value of cells of “cost distance” from the “cost raster” (each cell value = 1, edge cell size = meters, diagonal = 42 meters)

For example, how to MANUALLY calculate the “cost distance” for cell#55?

 

How can the “Distance Accumulation” or “Distance Allocation” can be a replacement for the “cost distance”? the “cost path” tool requires cost distance” as an input but not “Distance Accumulation” or “Distance Allocation”

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

with a cost surface having all cells with the value 1, the manual calculation is simply the sum of the lengths of the network edges going between cell centers from source to destination:

You can use the accumulated distance and back direction outputs from Distance Accumulation and Distance Allocation with any of the cost path family of tools:

cost path

cost path as polyline

optimal path as raster

optimal path as line

This blog post (which came out before the new Distance tools but is still relevant) discuses the back direction raster.

my recommendation is to use Optimal Path As Line if you need vector outputs and Optimal Path As Raster  for raster outputs.

As you can see from your test cases, your result from Distance Accumulation is not exactly the same as the output from euclidean distance, but its close and will get closer as you move farther away from the source. Unlike with cost distance and path distance tools, the results of Distance Accumulation and Distance allocation (and hence the outputs of Optimal Path as line, for example) will improve with reduced cell size.

JamalNUMAN
Legendary Contributor

This is the source of confusion for me!

 

I never figured out the relation between the cell values of cost raster (which is 1 in this case) and physical distance between the centers of the cells.

 

If I need to apply the given equation below, the cost at cell 55 is given by the equation below

 

Cost at (55) = cost (24) + cost (34)/2 + cost (34) +cost (44)/2 + 1.4 * cost (44) +cost (55)/2

Cost at (55) = 1+1/2 + 1+1/2 + 1.4 * 1+1/2

Cost at (55) = 1 + 1 + 1.4

Cost at (55) = 3.4

 

How the value of the cell which is 1 in this case is related to the physical distance between cells?

 

What if the values of all cells of cost raster is 2? What the cost distance at cell#55?

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