[GRASSLIST:5888] problems with grass6beta2 and R

Hello all,

is there anything wrong about grass6 and R?

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

any ideas?

thanks

+----------------------------------------------------------+
          Carlos Henrique Grohmann - Guano
   Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
        Linux User #89721 - guano at usp dot br
+----------------------------------------------------------+

Did you start R from within the GRASS-session?

Marco

-----Ursprüngliche Nachricht-----
Von: owner-GRASSLIST@baylor.edu [mailto:owner-GRASSLIST@baylor.edu]Im
Auftrag von Carlos Henrique Grohmann
Gesendet: Mittwoch, 23. Februar 2005 17:28
An: GRASSLIST@baylor.edu
Betreff: [GRASSLIST:5888] problems with grass6beta2 and R

Hello all,

is there anything wrong about grass6 and R?

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

any ideas?

thanks

+----------------------------------------------------------+
          Carlos Henrique Grohmann - Guano
   Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
        Linux User #89721 - guano at usp dot br
+----------------------------------------------------------+

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@nhh.no

Hi all,
I have installed grass-6.0beta2 and i get some trouble...
I made some commands in 5.7 that execute a query and get extracted value.... but with this new version they seems not to work correctly.....

in attacment you get the result of the query with pgmyadmin..

the code is:

/* fatch results of SQL - select basins */
  while(1) {
    if(db_fetch (&cursor, DB_NEXT, &more) != DB_OK)
      return (-1);
    if (!more) break;
    
    table = db_get_cursor_table (&cursor);
  
    // legge il bacino estratto
    column = db_get_table_column(table,0);
    db_convert_column_value_to_string (column, &value_string);
    basin = atoi(db_get_string (&value_string));
    
    //legge il min_row
    column = db_get_table_column(table, 1);
    db_convert_column_value_to_string (column, &value_string);
    min_row = atoi(db_get_string (&value_string));

it get me some error when I try to run atoi() but if run "printf("%s",db_get_string (&value_string)); it print the rigth value.....

Do you have any idea???

I also try with:
  while ( db_fetch (&cursor, DB_NEXT, &more ) == DB_OK && more ) {
  /* key column */
  column = db_get_table_column (table, 0);
     //ctype = db_sqltype_to_Ctype( db_get_column_sqltype (column) );
  //if ( ctype != DB_C_TYPE_INT ) G_fatal_error ( "Key column must be integer" );
  value = db_get_column_value(column);
  bacino = db_get_value_double ( value );
  basin = db_get_value_int ( value );
printf("bacino=%lf",min_row);while(!getchar()=="y"){}
printf("basin=%d",min_row);while(!getchar()=="y"){}

but the printed values are incorrect, in fact i get:

bacino=-1.994557
basin=-1

What's going wrong? And why under 5.7 version all works wonderfully?

Please try in helping me! I'm getting crazy!!!!!

Thanks,
Maxi

_
--------------------------------------
Eng. Massimiliano Cannata
Phd student
www.supsi.ch

(attachments)

SQL_RESULT.png

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.

-pete "A frustrated at times OSS Promoter"

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

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
> +----------------------------------------------------------+
>
>
>
>