[GRASS-user] R and GRASS

Hey folks,

I am somewhat new to GRASS and I am trying to get GRASS to talk with R in the way i want it to.
I am using the GRASS Version 6.4.2 and R 2.15.3 with RStudio.

My question is, how I can use execGRASS() from spgrass6 to do EXACTLY what GRASS would do?
When I try to simply display a vector-map like
library(spgarss6)
execGRASS(“d.vect”, parameters=list(map=“due”),intern=T)

it does not show add the vector map to my map-window but produces a .png-file… Any ideas?

Thank you in advance and happy after-easter,
Matthias

You probably need to start a monitor with d.mon first. Also, you should set intern to False. For example:

library(spgrass6)
execGRASS("d.mon", start="x1")
execGRASS("d.vect", map="due")

Cheers,

Paulo

On Tue 02 Apr 2013 09:36:09 AM CEST, matthias lauber wrote:

Hey folks,
I am somewhat new to GRASS and I am trying to get GRASS to talk with R
in the way i want it to.
I am using the GRASS Version 6.4.2 and R 2.15.3 with RStudio.
My question is, how I can use execGRASS() from spgrass6 to do EXACTLY
what GRASS would do?
When I try to simply display a vector-map like
library(spgarss6)
execGRASS("d.vect", parameters=list(map="due"),intern=T)
it does not show add the vector map to my map-window but produces a
.png-file... Any ideas?
Thank you in advance and happy after-easter,
Matthias

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

As I told you before, I use GRASS 7 that’s why I can use wxPython GUI and monitor (hence ‘wx0’).

In GRASS 6.4.3 I think that the name of the monitor are somewhat different.
I’m not sure but I think you’ll need something like this :

execGRASS(“d.mon”, start = “x0”)

···

On Tue, Apr 2, 2013 at 8:59 AM, matthias lauber <kamallauber@gmx.de> wrote:

Hey,

first: Thanks for the quick answer! My OS would be windows 7 Enterprise, SP1.
It did however not work for me, because d.mon is not implemented in the GRASS Version 6.4.2 GUI,which I use, and when I try to start the command through R I get this:


> execGRASS("d.mon", start = "wx0")

FEHLER: no such monitor 'wx0'
FEHLER: Es gibt das Grafikfenster <wx0> nicht.
FEHLER: Es gibt das Grafikfenster <wx0> nicht.
Probleme beim Auswählen von wx0. Einmal versuche ich es noch...
Warnmeldung:
Ausführung von Kommando 'd.mon.exe start=wx0' ergab Status 1 

which kind of translates to:
ERROR: there is no graphic window .

ERROR: there is no graphic window .

Problems chosing wx0. I will try once more…
Warnin:
Execution of command’d.mon.exe start=wx0’returned Status 1

Using the other commant anyway then gives:


> execGRASS("d.vect", parameters=list(map="due"),intern=T)

[1] "PNG: GRASS_TRUECOLOR status: TRUE" "PNG: collecting to file: map.png,"
[3] "GRASS_WIDTH=782, GRASS_HEIGHT=502"

which is the same as before.

I took the shape-files from here: http://www.ing.unitn.it/~grass/docs/tutorial_62_en/htdocs/esercitazione/geoprocessing/node1.html
but it does not really matter since the vector map itself is not important… i simply want it to be added to the location manager…

Is it good to send this reply to you only or should I, again, send it to the Mailing List in general? (my first question here…)

Greets,
Matthias

Gesendet: Dienstag, 02. April 2013 um 10:33 Uhr
Von: “Ahmadou Dicko” <dicko.ahmadou@gmail.com>
An: “matthias lauber” <kamallauber@gmx.de>
Betreff: Re: [GRASS-user] R and GRASS

Hi,

More info will be great for example. Which version of GRASS do you use and in which OS.
Using GRASS 7, I proceed like this :

1 - launch GRASS on the appropriate location/mapset
2 - launch R inside GRASS
3- in R do :

require(spgrass6)

open a window to plot first

execGRASS(“d.mon”, start = “wx0”)
execGRASS(“d.vect”, map=“due”)

uname -a : Linux dickoa 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux
GRASS version : GRASS 7.0.svn (2013)
R version : R version 3.0.0 RC (2013-03-30 r62448)
packageVersion(“spgrass6”)
[1] ‘0.7.15’

Hope this help


Ahmadou H. DICKO
Data scientist and applied economist
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69

On Tue, Apr 2, 2013 at 7:36 AM, matthias lauber <kamallauber@gmx.de> wrote:

Hey folks,

I am somewhat new to GRASS and I am trying to get GRASS to talk with R in the way i want it to.
I am using the GRASS Version 6.4.2 and R 2.15.3 with RStudio.

My question is, how I can use execGRASS() from spgrass6 to do EXACTLY what GRASS would do?
When I try to simply display a vector-map like
library(spgarss6)
execGRASS(“d.vect”, parameters=list(map=“due”),intern=T)

it does not show add the vector map to my map-window but produces a .png-file… Any ideas?

Thank you in advance and happy after-easter,
Matthias


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Ahmadou H. DICKO
Data scientist and applied economist
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
twitter : @dickoah
github : github/dickoa
tel : +221 33 827 55 16
portable: +221 77 123 81 69

Paulo van Breugel <p.vanbreugel@gmail.com> writes:

You probably need to start a monitor with d.mon first. Also, you
should set intern to False. For example:

library(spgrass6)
execGRASS("d.mon", start="x1")
execGRASS("d.vect", map="due")

I would suggest to ask R-GRASS questions at the list R-sig-geo
https://stat.ethz.ch/mailman/listinfo/r-sig-geo which is more targeted
to R and GRASS. But I agree with Paulos answer.

Cheers,

Rainer

Cheers,

Paulo

On Tue 02 Apr 2013 09:36:09 AM CEST, matthias lauber wrote:

Hey folks,
I am somewhat new to GRASS and I am trying to get GRASS to talk with R
in the way i want it to.
I am using the GRASS Version 6.4.2 and R 2.15.3 with RStudio.
My question is, how I can use execGRASS() from spgrass6 to do EXACTLY
what GRASS would do?
When I try to simply display a vector-map like
library(spgarss6)
execGRASS("d.vect", parameters=list(map="due"),intern=T)
it does not show add the vector map to my map-window but produces a
.png-file... Any ideas?
Thank you in advance and happy after-easter,
Matthias

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
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@krugs.de

Skype: RMkrug