I have a river network in raster and locations of many dams on the river.
In the image above, the BLUE point represent one random cell. Dam 1 is downstream to the cell.
I am looking to calculate the distance to the closest dam for each cell. And the distance should be calculate along the river network.
In the above picture, the distance from the blue point to Dam2 should be returned to the blue cell.
Does anyone know how to solve the problem using GRASS? I need the result as a raster file.
Some of my guess are given below.
I'm guessing some tools like r.cost?