[STATSGRASS] R - problem with mapsets

Roger Bivand Roger.Bivand at nhh.no
Thu Jul 29 12:49:21 EDT 2004


Now I have:

> library(GRASS)
GRASS environment variables in: /home/rsb/.grassrc5 
> G <- gmeta()
> summary(G)
Data from GRASS 5.0 LOCATION marta with 1 columns and 1 rows;
UTM, zone: 30
The west-east range is: 0, 1,
and the south-north: 0, 1;
West-east cell sizes are 1 units,
and south-north 1 units.
> get.mapsets()
[1] "ms2"       "PERMANENT"
> rast.get(G, "r")$r
[1] 456
> rast.get(G, "r at ms2")$r
[1] 456
> rast.get(G, "r at ms1")$r
[1] 123

which I think is what you want. The diagnosis was that G_find_cell() was 
overwriting the layer name, replacing "r at ms1" by "r", which was then found 
in "@ms2". I can either submit a new release to CRAN (I'll do that 
anyway), or put a draft package on my website for brave people to try - 
please tell me soon if I should NOT submit to CRAN before you have had a 
chance to check whether this change impacts your work (i.e. if you have 
been using the interface on multiple mapsets containing layers with the 
same names).

Thanks for a helpful bug report.

Roger


On Thu, 29 Jul 2004 marta.benito at uam.es wrote:

> Hello, thanks Roger, following the same example:
> 
> >grass5 ms1
> >R
> >(help(package=GRASS))
> Package: GRASS
> Version: 0.2-13
> Date: 2003/09/25
> >print(G) 
> $LOCATION
> [1] "rtest"
> $MAPSET
> [1] "ms1"
> $proj
> [1] "UTM, zone: 30"
> $n
> [1] 1
> $s
> [1] 0
> $w
> [1] 0
> $e
> [1] 1
> $nsres
> [1] 1
> $ewres
> [1] 1
> $Nrow
> [1] 1
> $Ncol
> [1] 1
> $Ncells
> [1] 1
> $xlims
> [1] 0 1
> $ylims
> [1] 0 1
> $xseq
> [1] 0.5
> $yseq
> [1] 0.5
> $ryseq
> [1] 0.5
> attr(,"class")
> [1] "grassmeta"
> get.mapsets()
> [1] "ms1"       "PERMANENT"
> r <- rast.get(G,"r at ms2")
> print(r)
> $r
> [1] 123
> > system("g.mapsets mapset=ms2")
> > refresh.mapsets()
> [1] "ms1" "ms2"
> > get.mapsets()
> [1] "ms1" "ms2"
> > r <- rast.get(G,"r at ms2")
> > print(r)
> $r
> [1] 123
> 
> 
> 
> Marta
> 
> 
> > On Wed, 28 Jul 2004 marta.benito at uam.es wrote:
> > 
> > > Hello, 
> > > I try to work in R (using GRASS library) with two different maps with the same
> > > name that are located in two different mapsets:
> > > mapset1: map r
> > > mapset2: map r
> > > 
> > > and allways I get the same map 
> > > 
> > > > grass5 ms1
> > > > g.region w=0 s=0 e=1 n=1
> > > > r.mapcalc r=123
> > > > exit
> > > 
> > > > grass5 ms2
> > > > g.region w=0 s=0 e=1 n=1
> > > > r.mapcalc r=456
> > > > R
> > > > library(GRASS)
> > > > G <-gmeta()
> > > > r <- rast.get(G,"r at ms1")
> > > > r
> > > $r
> > > [1] 456
> > 
> > I'll have a look, could you tell me which version of the GRASS interface 
> > you are using (help(package=GRASS)), and what print(G) says? What does 
> > get.mapsets() say?
> > 
> > Roger
> > 
> > > 
> > > 
> > >  
> > > Thanks
> > > 
> > > Marta
> > > 
> > > --------------------------------------------------------------------------
> > > Mensaje enviado mediante una herramienta Webmail integrada en *El Rincon*:
> > > ------------->>>>>>>>     https://rincon.uam.es     <<<<<<<<--------------
> > > 
> > > 
> > > _______________________________________________
> > > statsgrass mailing list
> > > statsgrass at grass.itc.it
> > > http://grass.itc.it/mailman/listinfo/statsgrass
> > > 
> > 
> > -- 
> > 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
> > 
> > 
> > _______________________________________________
> > statsgrass mailing list
> > statsgrass at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/statsgrass
> > 
> > 
> 
> 
> --------------------------------------------------------------------------
> Mensaje enviado mediante una herramienta Webmail integrada en *El Rincon*:
> ------------->>>>>>>>     https://rincon.uam.es     <<<<<<<<--------------
> 
> 
> 

-- 
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-stats mailing list