I want to do a neigbourhood analysis on some raster data. I need to know how big a circle around each raster cell must be to include a certain amount of specified raster cells.
Let's say that for both rasters I want to know the radius of the circle needed to reach an aggregated value of 5. In the first case the "circle" must have a radius of 2 to reach the sum of the desired 5 because a radius of 1 would only include one raster cell that I am interested in. In the second case already a smaller circle with a radius of 1 is sufficient.
My outcome should thus be a raster file where every cell has the value of the radius that is needed to reach that defined sum.
I was thinking a long time about a good title for this question. I would welcome better suggestions.
Best Answer
The answer to your question depends on the scale of your raster and if you want a unique raster "buffer" for the whole layer or per grid cell. For the first choice: The best way on QGIS might be to use the
r.neighbors
GRASS plugin inside the Processing toolbox for QGIS 2.0.See a the manual here: http://grass.osgeo.org/grass65/manuals/r.neighbors.html
To do what you want you might have to build a little model in Processing, but maybe there is an easier way. The general Idea:
RasterLayerName@1 < 5
).