[GRASS-user] Importing xyz raster with corner coordinates?

Hello,

I need to import a set of raster data in ASCII xyz format, with the coordinates referring to the southwest corner of the grid cell rather than the center as is the convention. I can think of a number of clumsy ways to solve the problem by scripting, either involving importing the raster first with an incorrect region definition, or by batch editing the text files, but am wondering if there is an elegant way to do this. For example, adding a simple +(resolution / 2) offset to both the lat and lon coordinates would do. I already tested and simply using the correct region definition and hoping that the data falls into the correct grid cells does not work.

I am importing a total of over 2000 raster layers, so the solution needs to be automated. I work with .sh scripts.

This is the dataset in question, in case it is of relevance:
http://www.nies.go.jp/REAS/#data sets

···

Thank you for any help, Best

Lauri Myllyvirta (Mr.)
senior global campaigner, coal
Greenpeace
mobile +48 66 40 66 382 (Poland, primary)
mobile +86 157 1002 1563 (China)
skype laurimyllyvirta

On 23/02/15 14:48, Lauri Myllyvirta wrote:

Hello,

I need to import a set of raster data in ASCII xyz format, with the
coordinates referring to the southwest corner of the grid cell rather
than the center as is the convention. I can think of a number of clumsy
ways to solve the problem by scripting, either involving importing the
raster first with an incorrect region definition, or by batch editing
the text files, but am wondering if there is an elegant way to do this.
For example, adding a simple +(resolution / 2) offset to both the lat
and lon coordinates would do. I already tested and simply using the
correct region definition and hoping that the data falls into the
correct grid cells does not work.

How about r.region (not g.region) with something like:

r.region YourMap n=n+[res*0.5] etc

?

Moritz

Perfect, thank you!

···

On Mon, Feb 23, 2015 at 3:15 PM, Moritz Lennert <mlennert@club.worldonline.be> wrote:

On 23/02/15 14:48, Lauri Myllyvirta wrote:

Hello,

I need to import a set of raster data in ASCII xyz format, with the
coordinates referring to the southwest corner of the grid cell rather
than the center as is the convention. I can think of a number of clumsy
ways to solve the problem by scripting, either involving importing the
raster first with an incorrect region definition, or by batch editing
the text files, but am wondering if there is an elegant way to do this.
For example, adding a simple +(resolution / 2) offset to both the lat
and lon coordinates would do. I already tested and simply using the
correct region definition and hoping that the data falls into the
correct grid cells does not work.

How about r.region (not g.region) with something like:

r.region YourMap n=n+[res*0.5] etc

?

Moritz

Lauri Myllyvirta (Mr.)
senior global campaigner, coal
Greenpeace
mobile +48 66 40 66 382 (Poland, primary)
mobile +86 157 1002 1563 (China)
skype laurimyllyvirta