0

I have two points A and B. If I calculate cumulative costs from A to B respectively from B to A I expect the same cumulative costs at the arrival points. Take into account that the walk_coeff are set symmetrically:

  • From A to B: a,b,c,d=0.72,6,10,-10
  • From B to A: a,b,c,d=0.72,10,6,-6

Details for abcd you find under r.walk

As the uphill/downhill coefficients are symmetrical, theoretically the cumulative costs should be identical at the arrival point. It doesn't matter if travel from A to B or from B to A. Interestingly the cumulative costs do differ!

If I calculate at a resolution of 1 m the difference is relatively small, if I calculate at a resolution of 10 m the difference can become big.

What I tried:

  • I tried to place A and B to the center of the next pixel
  • I tried the option -k (Knight)

Any ideas?

r.walk elevation=dem@PERMANENT friction=cost@PERMANENT output=cumCostUp outdir=movDirUp start_points=start@PERMANENT stop_points=stop@PERMANENT max_cost=10000000 null_cost=16000 walk_coeff=0.72,6,10,-10 lambda=0.2 --overwrite
v.what.rast map=stop@PERMANENT raster=cumCostUp@PERMANENT column=cumCost
r.walk elevation=dem@PERMANENT friction=cost@PERMANENT output=cumCostDown outdir=movDirDown start_points=stop@PERMANENT stop_points=start@PERMANENT max_cost=10000000 null_cost=16000 walk_coeff=0.72,10,6,-6 lambda=0.2 --overwrite
v.what.rast map=start@PERMANENT raster=cumCostDown@PERMANENT column=cumCost

Some additional information:

  • dem and cost have a resolution of 10m. Pixels are tapped to 10 m (-tap from GDAL)
  • start and stop coordinates are in X and Y: n*10 + 5
  • The difference becomes minimal with very small resolutions x=1 or x=0.1 (r.region res=x). So the mirroring of abcd is correct.
  • If b=c=d=0 there isn't anymore an asymmetry.
  • If uphill and downhill cost are set both to 6 there is still an asymmetry.

Sample data you find here: Sample-Data with EPSG=21781.

Bug-Report on GRASS-Github

1
  • Please look at the definition of abcd in r.walk Commented Jul 25, 2022 at 8:02

2 Answers 2

0

The uphill slopes going from A to B will, of course, become downhill when going from B to A. There is only one coefficient b for uphill slopes, but the downhill direction gets split depending on moderate downhill or steep downhill. So the different c and d coefficients will, I think, cause the difference you are seeing.

1
  • The mirroring is correct! Look at the definition in r.walk. b is uphill, c=-d is downhill. Take into account, that the difference in the cumulative cost becomes minimal the higher the resolution is set with r.region res=x. With x=0.1 the difference is almost none. With x=10 the difference is relatively big. Working with x=0.1 is not realistic. Commented Jul 25, 2022 at 7:58
0

c must be equal to d.

The following example produces a symmetrical result for all resolutions r, also for r=10: From A to B: a,b,c,d=0.72,6,-10,-10 From B to A: a,b,c,d=0.72,10,-6,-6

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.