[GRASS-user] Re: r.mapcalc r.mapcalculator question

Dr. Manfred Redslob redslob at gdf-hannover.de
Wed Jun 16 04:34:25 EDT 2010


Am Mittwoch, den 16.06.2010, 01:10 -0700 schrieb varunvarma:
> 
> Micha Silver wrote:
> > 
> > On 15/06/2010 16:45, Dr. Manfred Redslob wrote:
> >> Am Dienstag, den 15.06.2010, 06:39 -0700 schrieb varunvarma:
> >>    
> >>> Hi, I am a new user to GRASS and have run into a problem while
> >>> processing
> >>> rasters
> >>>
> >>> I have 2 raster files (TIFFs) which I have loaded with GRASS in QGIS
> >>> 1.0.2
> >>> Kore. The rasters contain values of 0 and 1 and represent 2 time steps.
> >>> What
> >>> I wanted to do is either a simple addition of the 2 rasters or apply an
> >>> OR
> >>> operator between them. For this I used the r.mapcalc and r.mapcalculator
> >>> tool. However, the cell size of the resulting raster is increased from
> >>> 250m
> >>> to 2500m which leads to loss of fine scale information.
> >>>
> >>> Does anyone know why this is happening and what I could do to maintain
> >>> the
> >>> fine scale information?
> >>>
> >>> Thank you
> >>>      
> >> Hi however,
> >>
> >> please check the actual resolution with g.region -p. Is the result
> >> res=2500? If so, set region with g.region -ap res=250 or with g.region
> >> rast=inputrasterfile. You can controll it again with  g.region -p. After
> >> this settings run r.mapcalc again.
> >>
> >> Regards,
> >>
> >> Manfred
> >>
> >>    
> > In addition, to do the same thing within QGIS, you can use the "Edit 
> > current region" button on the GRASS toolbar. Just enter the value you 
> > need in the N-S resolution and E-W text boxes.
> > 
> > Another note: I might suggest you upgrade to a newer version of QGIS.  
> > Version 1.4 (and soon to be released 1.5) have many improvements and bug 
> > fixes.
> > Regards
> > 
> >> _______________________________________________
> >> grass-user mailing list
> >> grass-user at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/grass-user
> >>
> >> This mail was received via Mail-SeCure System.
> >>
> >>
> >>    
> > 
> > 
> > -- 
> > Micha Silver
> > http://www.surfaces.co.il/
> > Arava Development Co.  +972-52-3665918
> > 
> > _______________________________________________
> > grass-user mailing list
> > grass-user at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/grass-user
> > 
> > 
> 
> Thank you all for your replies. I ran g.region to set the cell size (res) in
> GRASS 6.4.0 and then used r.mapcalc to do an addition between the rasters
> and it worked perfectly.
> 
> Just to understand the solution better, is there a reason why the cell size
> was changed when an addition was performed on the rasters OR was it that the
> cell size was changed when rasters were imported into GRASS?
> 
> Thank you,
> Varun

Hi Varun,

I do'nt know, at which time the resolution changed (maybe it's the
default-region of your location?: g.region -dp). But raster operations
within GRASS are using the actual region settings and the new map would
be created with this settings, independent of the input raster maps. So
it's possible to generate raster maps with a new (higher or lower)
resolution and also maps clipped to a part of the input maps (to sphere
of interest) to save disc space, or memory capacity.

So before working with rastermaps it would be usefull to controll the
region settings.

Best regards,

Manfred




More information about the grass-user mailing list