A solution? (including resolution) - Re: [GRASS-user] Re: Help: Converting a raster map between locations (from wgs84 lat / long to UTM)

Glynn Clements glynn at gclements.plus.com
Wed Nov 5 16:58:06 EST 2008


Corrado wrote:

> > > does the r.proj resample the raster?
> > >
> > > The documentation seems to suggest you have to use g.region -m, .... or
> > > may be I did not understand it properly.
> >
> > Like most raster commands, the output from r.proj has bounds and
> > resolution which match the current region settings.
> >
> > For each cell in the current region, r.proj reverse-projects the
> > cell's centre to the source region. It samples (or interpolates) the
> > input map at that point, and stores the sampled/interpolated value in
> > the corresponding cell in the output map.
> 
> I am not sure I understand the recommend process then.
> 
> If r.proj matches the region of the output by resampling, why do we have to 
> set the same region in the input and output locations?

You don't. r.proj ignores the source mapset's region settings; the
input map is read 1:1.

> As long as the ouput 
> location is set to a subset of the input location, then r.proj should then be 
> able to project (and resample). Is that right?
> 
> On the other hand, what method does r.resample use?

Nearest neighbour. r.resample simply copies the data using GRASS'
built-in resampling. If you want interpolation, use r.resamp.stats.

The main reason for using r.resample is as an optimisation. If you
will be reading a map repeatedly at a coarser resolution, using a
down-sampled copy will be faster than relying upon GRASS resampling
the original on-the-fly each time.

> is it cubic? if that is the case, the result should be more or less
> the same as r.proj method=cubic.

Re-projection involves irregular resampling. Using "r.proj method=cubic"
will produce more accurate results than resampling the source using
e.g. "r.resamp.interp method=bicubic" followed by "r.proj method=nearest".

The sampling performed by r.proj is unavoidable, but you wouldn't
normally want to introduce any additional resampling steps.

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


More information about the grass-user mailing list