[GRASS-user] New r.what.vect.buffer addon module [was: query by distance]

Hamish hamish_b at yahoo.com
Thu Oct 9 19:46:33 EDT 2008


Edmondo:
> > there is an easy way to select (on a raster map) all features into a
> > certain radius from a specific point?

Nikos:
> Maybe something using r.buffer/v.buffer --> YourBuffer (rasterize if it
> comes from v.buffer), then r.mapcalc MASK=YourBuffer, then operate
> within the MASK?


Hi,

fyi I've recently added a new addon module called r.what.vect.buffer.
  http://grass.osgeo.org/wiki/GRASS_AddOns#v.what.rast.buffer

The idea is to provide local environmental context to a series of vector
points.

v.what.rast or r.what + coord alone may return a spike in the raster data
without you knowing. What this script does is create a buffer around each
vector point and gather some stats about the raster cells nearby and
report them in a .csv table. Multiple raster maps can be sampled.
I assume the location is not lat/lon, and (in column names) that units
will be meters. (r.buffer would be lat/lon safe; but I used r.circle
because it allows starting from an exact coord not from the nearest cell)

v.rast.stats + v.buffer is problematic when input points' buffers overlap.


GRASS> v.what.rast.buffer --help

Description:
 Calculates univariate statistics of raster map(s) from buffers around vector points.
 Results are written to a file. Resolution is taken from each input map.

Keywords:
 vector, raster, statistics

Usage:
 v.what.rast.buffer input=name raster=name[,name,...] buffer=value
   [output=name] [fs=character] [--verbose] [--quiet]

Flags:
 --v   Verbose module output
 --q   Quiet module output

Parameters:
   input   Points vector map containing query positions
  raster   Name of raster map(s) to calculate statistics from
  buffer   Buffer distance in map units
           default: 100
  output   Name for output file (if omitted or "-" output to stdout)
      fs   Field separator in output file
           default: |


spearfish example:
  v.what.rast.buffer in=archsites rast=elevation.dem,slope out="-"


enjoy,
Hamish



      



More information about the grass-user mailing list