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

Rainer M Krug Rainer at krugs.de
Thu Sep 10 04:19:25 PDT 2015


Markus Neteler <neteler at osgeo.org> writes:

> 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=",")

Which data set do you mean? I don't have the maps in the
nc_basic_spm_grass7 dataset?

did you try to use intern=TRUE :

,----
| intern: default NULL, in which case set internally from
|           ‘get.useInternOption’; a logical (not 'NA') which indicates
|           whether to make the output of the command an R object. Not
|           available unless 'popen' is supported on the platform
`----

Other options to try:

,----
| Sys_ignore.stdout, Sys_wait, Sys_input: pass extra arguments to
|           ‘system’
| 
| Sys_show.output.on.console, Sys_minimized, Sys_invisible: pass extra
|           arguments to ‘system’ on Windows systems only
`----

Cheers,

Rainer

>
> 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
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150910/c129c0be/attachment.pgp>


More information about the grass-stats mailing list