I have a binary raster (0s and 1s) that I need to query given a set of point coordinates. This is easy enough to do with gdal (
gdallocationinfo), but where it get's complicated is that I also need to return the sum of the 8-cell neighborhood. Is there an easy way to do this without processing the entire map?
In GRASS the only way I can think to do this is to use
r.mapcalc to return a sum of the cell I'm interested in and then change the value of all other cells to 0. This allows me to compute an aggregate sum for the map with
r.sum. But this requires a great deal of processing and if I need to do this for hundreds of points, the task becomes enormous.