[GRASS-user] query raster cell and its neighbors by point

Nikos Alexandris nik at nikosalexandris.net
Thu Mar 14 12:37:48 PDT 2013


Shaun Langley wrote:
> > I need to easily query a raster and return both the value of the cell and
> > the aggregate value of the 8-cell neighborhood, given a set of point
> > coordinates.  I know I can easily do this with r.mapcalc, but that
> > involves running the computation for the entire map even though I'm only
> > interested in a very very small portion.  Is there an easier way to do
> > this or am I stuck with the long solution?

Nikos Alexandris wrote:
> What kind of an aggregation exactly?  Maybe not straight-through, but
> I think you will be "forced" to use G7:
> http://grass.osgeo.org/grass70/manuals/r.neighbors.html
> 
> in a way like

> r.neighbors \
> input=QueriedRaster \
> selection=CellsOfInterest \
> output=AggregatedRaster \
> method=SomeMethod[,MoreMethods,EvenMoreMethods] \
> size=3 \
> title="Aggregated raster map"

> However, you say you need the "queried" cell-value as well. Maybe combine
> with 
> http://grass.osgeo.org/grass70/manuals/r.what

Maybe combine all this with a MASK? i.e., create buffer(s) around your 
coordinates of interest, use r.what and r.neighbors then?

(@MMetz -- maybe of your interest?) 
And, at this point comes the idea:  why not let r.neighbors, when a 
"selection=RasterMap" is defined, return in an extra raster map the one-central 
queried cell?

Best, Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130314/ab62ed76/attachment.pgp>


More information about the grass-user mailing list