projecting rasters

Simon Cox s.cox at dem.csiro.au
Wed May 17 08:00:00 EDT 1995


At  9:01 AM 16/5/95 +0200, Cosyn Bart wrote:
>> Hello,
>>
>> Has anyone done any projection conversions on raster files?
>> If so, I would like to hear how you went about it, it seems
>> a bit complicated to me.
>
>Hi  Steve,
>I worked a few months ago on some problems to change from our Belgian
>Lambert projection to UTM and vice versa. As far as I know there was no
>conversion tool to do so in Grass. The way I solved the problem was by
>rectifying the image from one location to another. I used the module
>i.rectify ...

Although this may produce an approximate solution, it is NOT the right
method.  i.rectify uses an essentially statistical method to perform a
generalised image warp.  It is intended for use with imagery where camera
position effects, and lens and media distortions lead to an arbitrary
mis-registration.  Projections, on the other hand are precise mathematical
functions and so forward and inverse transformations can be done exactly.
This is the approach used by the GRASS programs v.proj, m.ll2u, etc.  It
should be the method used in shifting already-registered rasters from one
projection to another.

The lack of r.proj has been discussed many times on this list in the past
(check the archives).  GRASS tools to accomplish it properly do exist,
however, if they are used in the correct combination.  The most difficult
step is getting the raster in the destination projection gridded correctly:
since the cell locations in the source projections do not correspond with
required cell locations in the destination projection, some interpolation
method is required.  Depending on the nature of the data different methods
should be used - for example, typically nearest-neighbour for categorical
data, or some smooth interpolant for continuous data.

Quoting a previous posting of mine to the list, the general flow would be:

=======
(i) in GRASS in the NEW projection, use r.stats -1gz to generate a list of
desired cell locations.  Cell values will not be used so any layer can be
used
(ii) outside of GRASS use awk and Gerry Evenden's proj to convert this to a
site list in the old projection
(iii) in GRASS in the OLD projection use Darrell McCauley's s.sample to
generate a list of values at the positions in this site-list
(iv) edit/awk this so that it can be swallowed by r.in.ascii - a small
program might have to be written to make this quick
(v) in GRASS in the NEW projection run r.in.ascii.

In putting together s.sample, Darrell McCauley has kindly implemented
bilinear, nearest-neighbour and cubic interpolators, and since it works in
the "implicity indexed" raster domain, it will run quick.
========

I hope that this is clear, and that the important difference between
projections and rectification is also apparent.  It does require you to do
a little "programming" here and there, but this is possible because you
understand what is happening (!) and the file formats for GRASS are
published - after all, GRASS is really a research tool and no-one ever
claimed that it was a slick turn-key package.  Does this sound a bit
protestant? ;-)

Good luck               Simon Cox

___________________________________________________________
Dr Simon Cox                          __  \
CSIRO Exploration & Mining         ,~'  L_|\    Australian
39 Fairway, PO Box 437,         ;-'         \   Geodynamics
Nedlands, WA  6009  Australia   (            \  Cooperative
      Phone +61 9 389 8421      +    ___     /  Research
      Fax   +61 9 389 1906       L~~'   "\__/   Centre
s.cox at dem.csiro.au                         W
AGCRC info>>   http://www.dem.csiro.au/simon/crc/intro.html
___________________________________________________________







More information about the grass-user mailing list