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