[GRASS-stats] How to use r.what in rgrass7?

Markus Neteler neteler at osgeo.org
Thu Sep 10 04:02:03 PDT 2015


Dear list,

I try to query from R a raster map at given vector point positions
(both maps are in GRASS but it could well be that the points are in R
and the (huge) raster map in GRASS).

So, simple North Carolina data set example:

goutput <- execGRASS("r.what", map="elev_state_500m",
points="geodetic_pts", separator=",")

I would expect that the result is stored in "goutput" (seems it is)
but it also dumps it into the terminal which I would like to avoid. I
don't manage to switch that off.

Then, following this blog
https://pvanb.wordpress.com/2013/01/23/import-grass-function-console-output-as-data-frame-in-r/

I tried to parse the output:
con <- textConnection(goutput)

which fails with
Error in textConnection(goutput) : invalid 'text' argument

Does anyone have a suggestion how to turn the output of r.what into an R object?

Likewise suggestions are welcome how to feed R point positions into
r.what from R.

Hope I am not asking too much :-)

thanks,
Markus


More information about the grass-stats mailing list