[GRASSLIST:6029] Re: problems with grass6beta2 and R

Roger Bivand Roger.Bivand at nhh.no
Mon Mar 7 03:12:54 EST 2005


I'm forwarding to the list my off-list reply to Pete Lancashire, to which
he has not had the courtesy to respond, in particular to my offer (at foot
of message) to interact with him in trying to find a resolution to his
immediate needs. The only response was to post a *bug* report on the known
fact that the GRASS5.* interface to R doesn't work in compiled mode with
GRASS6 - reports indicate that it seems to work in interpreted mode for 
raster layers.

I will be establishing a sourceforge sandbox to publish ideas (see
discussion below), and am grateful to Paolo Cavallini and Miha Staut for
their ideas so far. I will post the address when ready.

Roger Bivand

---------- Forwarded message ----------
Date: Sat, 5 Mar 2005 21:46:24 +0100 (CET)
From: Roger Bivand <Roger.Bivand at nhh.no>
To: Pete Lancashire <list at pdxeng.com>
Subject: Re: [GRASSLIST:5891] Re: problems with grass6beta2 and R

Pete:

On Sat, 5 Mar 2005, Pete Lancashire wrote:

> I just want to add a voice to this.
> 
> I'm trying to 'promote' the use of OSS withing a
> very conservative industry and am putting together
> a demo that includes Grass with PostGIS and R.
> 
> Doing a demo with Grass with R would have been a 90%
> winner. And believe that if successful development
> money could surface.
> 
> I would hope that in the future the Grass dev. team
> take into consideration input from other projects
> that are helping make Grass a valid alternative.
> Saying that, I do want to add my greatest admiration
> for the project so far.
> 
> My only recourse is to "down grade" to 5.4, but that
> will then kill some of the other demo's.
> 

The interface was just for rasters in 2D, and was extended to sites. The 
problem that has occurred is because a very quick decision was made to 
alter a fundamental file structure for 6.0, a file structure that has been 
fixed essentially since GRASS began. If I change the current interface, 
which works for most users, their work will be broken. 6.0 is not yet 
released, and is a fast moving codebase, which is by definition hard to 
interface to. 

My repeated requests to the list for advice and help from 
people who actually use 6.0.0beta* has yielded a two-line script using 
system() in R - which could be elaborated for handling vectorised sites, 
and an offer to try out anything I happen to write. But *no* offers of 
code or working examples of loose coupling (writing the GRASS vector 
layer(s) to file as a shapefile or e00, reading into R, writing from R as 
a file, importing into GRASS). 

We also have rgdal as the GDAL bindings for R, and it is quite possible
that alpha code for OGR could get to where you need to be. But that isn't
what you are putting on the table, is it? 

(At least part of the problem is that GRASS6 vector also involves using
(as you include below) various databases, which R can talk to directly -
so the R/GRASS interface remains just R/GRASS for raster, but potentially
becomes R/(GRASS hands off a driver to) many different databases -
designing for this could potentially drop GRASS and just go to the
databases, or even reverse roles and embed the R engine inside GRASS or
the database. I suspect that this includes so many local variants that 
the vector interface will have to be loose-coupled, or tightly 
customised with the database drivers; R could also be embedded elsewhere 
I think, depending on the distribution of tasks and which process is "in 
charge" - now R runs on top of GRASS with the user using the R 
interface, but with embedding, this can be done differently - see:
http://www.est.ufpr.br/myR/ for an example. See also: 
http://www.math.uni-klu.ac.at/~agebhard/preDSC2003.pdf).

> -pete "A frustrated at times OSS Promoter"

Well, just imagine how frustrated volunteer overtime developers and 
especially maintainers feel! You add new fun stuff and get current users 
all over you very quickly!

> 
> P.S. Demo would have included Grass6, R, GDAL, PostGIS,
> MySQL, data exchange with Oracle 10g, PHP, Perl, Apache,
> and a Beowulf Clusters.
> 

Please describe in detail what needs to be passed between GRASS and R, and 
how much time you can give me to try it out - you have the examples, I 
don't - and I'll try and give you some pointers and R scripts. Please 
also state the version of your platform and at least GRASS, GDAL, and 
R. The GRASS interface (note 5.0!) began that way. If it's simple enough - 
write a shapefile from GRASS, read a shapefile into R, do stuff, write 
shapefile or raster (Arc ASCII GRID works anyway) or whatever with new 
stuff, read into GRASS, it's doable.

Roger

> 
> 
> On Wed, 2005-02-23 at 10:39, Roger Bivand wrote:
> > On Wed, 23 Feb 2005, Carlos Henrique Grohmann wrote:
> > 
> > > Hello all,
> > > 
> > > is there anything wrong about grass6 and R?
> > 
> > This has now been raised many times. The GRASS/R interface was broken by 
> > the imposition of 3D windows in GRASS 6 (and sites have gone away too). It 
> > is reported to work with the interp= argument set to TRUE, that is, not 
> > using the compiled interface, but exchanging text files. Please note the 
> > full title of the GRASS package in R: "Interface between GRASS 5.0 
> > geographical information system and R" - in fact 5.4 still works as 
> > designed, but 6.0 does not. 
> > 
> > I am open to offers of help to rectify this, and suggested doing this on
> > sourceforge so that others can contribute.  Many users depend on GRASS 5
> > and the interface, so the current structure must be maintained;
> > development of a 6.0 version can be done, but needs contributions from
> > people actually using 6.0 and willing to help replace the sites functions
> > and write vector functions.
> > 
> > > 
> > > I tried to run it today and look what I get:
> > > 
> > > 
> > > > library(GRASS)
> > > GRASS environment variables in: /tmp/grass6-guano-5178/gisrc
> > > > G<-gmeta()
> > > Error in gmeta() : Bad or no region for current mapset
> > > >
> > > 
> > > I installed the R GRASS package with:
> > > > R CMD INSTALL --configure-args=--grass5=/usr/local/bin/grass60
> > > GRASS_0.2-23.tar.gz
> > > 
> > 
> > The "--configure-args=--grass5=/usr/local/bin/grass60" have been 
> > redundant for about three years, by the way, because the package contains 
> > copies of GRASS library source files for 5.* raster and sites access, and 
> > so does *not* link to binary libraries (this was a problem on cygwin at 
> > the time).
> > 
> > Roger Bivand
> > 
> > 
> > > any ideas?
> > > 
> > > thanks
> > > 
> > > +----------------------------------------------------------+
> > >           Carlos Henrique Grohmann - Guano  
> > >    Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
> > >         Linux User #89721  - guano at usp dot br
> > > +----------------------------------------------------------+
> > > 
> > > 
> > > 
> > > 
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no








More information about the grass-user mailing list