[GRASS-user] r.mapcalc on rasters with different resolutions and origin

Glynn Clements glynn at gclements.plus.com
Fri Jul 22 22:18:21 EDT 2011


Enrico Gallo wrote:

> I would like to use r.mapcalc in order to compare 2 different resolution
> floating-point raster (A = 1km and B = 100 m) and to calculate some
> statistics on the finest resolution map ( so g.region res=100)
> 
> As the two layers have different resolution and origin, some doubts arise :
> 
> does r.mapcalc use *nearest neighbour* to perform calculation?

The GRASS libraries use nearest-neighbour to resample raster maps to
the current region. This affects any module which doesn't specifically
change the region (and r.mapcalc doesn't),

[The r.resamp.* modules *do* change the region to match the input.]

> is a resample using *r.resamp.interp* (bilinear or cubist) suggested/needed
> before running r.mapcalc?

That depends upon the nature of the data. Ask yourself: if r.mapcalc
insisted that all inputs had the same resolution and alignment, how
would you perform resampling? If you would use nearest-neighbour, then
you don't need to manually resample, otherwise you do.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list