I would like to create a raster where each cell contains the vertical distance to the nearest water (a decent approximation would be acceptable). The problem is that I'm not sure how to go about it.
I've looked through the documentation for my GIS (I'm using Grass 6.4 if that matters). And I can't find any direct way to perform this calculation. I've also searched the web without luck.
So I dreamed up the following:
- convert my water vector to a water raster (1=water, null=everything else)
- replace the 1s in the water raster with the altitude above sea level
- perform "neighborhood" (moving window) analysis. Calculate the average altitude of water for a 100 meter radius for every cell in my region (ignoring nulls)
- repeat the above with 100m, 200m, 300m, ..., 2000m. One raster for each distance.
- using r.grow.distance calculate the distance between each cell and it's nearest water
- then, using map algebra, I look at the distance to nearest water for each cell and its own altitude and subtract the average altitude of water for the appropriately distanced raster.
The problems with my method:
It is very computationally demanding. I am working at a 10m resolution and I need to perform this modelling on around 60 million cells. I've been creating rasters on a fast desktop for days and days and I'm not even close to finished.
At small radii, the calculation seems reasonable. If the distance to nearest water is 75 meters and I use a 100 m average altitude to water, the approximation is pretty good. But if the distance to nearest water is 1875 meters and I use the 1900 meter raster I will be averaging in the altitude to water of many cells far removed from the nearest water to my cell. The results are dissatisfying. I considered using some kind of smoothing process for the final raster but I wonder if there is a completely different approach that I am not seeing.
I've been reading about predictive modeling projects where vertical distance to nearest water is a one of the inputs to the model so I know it can be done but I'm just not sure how.
I'd appreciate any help I can get with this problem. Thanks.