I have a DEM in QGIS and I want to calculate a ruggedness index that calculates the sum change in elevation between a grid cell and its 8 neighbor grid cells. I have seen several methods to do neighborhood analysis like r-neighbor or LecoS plugin, but from what I've seen they only can do some calculations like average, sum, maximum, etc. I need a custom analysis to build my index. The calculation for the index is this:
Index=[(Σ(el(0,0)-el(i,j))²]^½
Where el is the name of the elevation cell (i and j are -1, 0 or 1).
I think in ArcGis it's possible to do this custom calculation with DOCELL, but I don't know what's this, I don't have access to this program and I don't know how to use it.
Is there an option to do it with QGIS, R-statistics or anything else?
Answer
I think (but I didn't prove it, but the raster calc. says its valid) the syntax you're looking for is square brackets for the relative coordinates, in your case:
sqrt((el-el[-1][-1])^2 + (el-el[0][-1])^2 + ...)
Since there is no 'moving window' funcionality in QGIS Raster Calculator, you have to explicitly add all the surrounding cell values, which might become inappropriate if you have, say, 7x7 windows or so.
You might consider to have a look at r.neighbors GRASS algorithm via the toolbox, cp. How to find buffer radius around raster cell that covers a defined sum of raster cells?
No comments:
Post a Comment