# Implementing travel cost equation in Google Earth Engine with image math?

As a follow up to How can I estimate a Least Cost Path in Google Earth Engine?, I am still trying to estimate walking time in Google Earth Engine based on a slope-based cost equation using the cumulativeCost function. I don't understand why the result is so much faster than in ArcGIS 10.6 (using the same 30m SRTM DEM). As far as I can tell, GEE cannot calculate slope based on travel direction, so I am using an equation that doesn't distinguish travel direction – for example, walking time is the same at -5 and +5° (Rees 2004). The formula is in meters per second, which I divided by 3600 to get hours per meter. It looks like this in Excel:

``````=(0.75+(0.09*ABS(TAN(RADIANS(slope_in_degrees))))+(14.6*(ABS(TAN(RADIANS(slope_in_degrees))))^2))/3600
``````

The highest speed is at 0°, 4.8 km/h or according to the Excel formula, 0.0002083 h/m. This is my attempt to implement this in GEE in this code, based on Tyler Erickson's code.

Is this correct?

``````var slope_in_radians = slope.multiply(3.1415).divide(180);
var cost = (
ee.Image(0.09).multiply(
)
ee.Image(14.6).multiply(
.multiply(ee.Number(2).exp()
)))).divide(3600)
);
``````

(I liked his suggestion of the simpler ee.Image.expression() syntax, but I couldn't get it to work; the error was that "abs" was not defined).

This code gives me a reasonable result that shows travel time increases in steeper areas (the white rings should be contour lines in hours): However, when we ran the same analysis in ArcMap 10.6 (from Steve Wernke!), we got a much slower and more realistic result (~4 km are traversed in about an hour, as expected). It is also similar to other cost equations we ran in ArcMap, so I think something is wrong with the GEE result. How can I get GEE to produce the same results as ArcGIS?

Here's the relevant part of Rees 2004 (I used equation 1). 