[GRASSLIST:9281] ArcInfo Grid vs r.in/out.gdal

Hi

As we know, in ArcInfo grids the coordinates refer to the cell centre.
In Grass it is the bottom-left corner of the cell. Now, when I import an
ArcInfo binary grid into Grass using r.in.gdal, is it automatically
shifted half a pixel resolution to cope with this issue or not? How
about r.out.gdal when writing to an ArcInfo binary or ascii grid?

Best,
Maciek

--------------------
Historia, która przeros³a fikcjê. Chcesz poznaæ rozwi±zanie jednej z najwiêkszych tajemnic II wojny ¶wiatowej?
Przeczytaj BURSZTYNOW¡ KOMNATÊ, Catherine Scott-Clark, Adrian Levy
http://www.rebis.com.pl/rebis/strony/pokaz_ksiazke.html?id=32787

As we know, in ArcInfo grids the coordinates refer to the cell centre.
In Grass it is the bottom-left corner of the cell. Now, when I import
an ArcInfo binary grid into Grass using r.in.gdal, is it automatically
shifted half a pixel resolution to cope with this issue or not? How
about r.out.gdal when writing to an ArcInfo binary or ascii grid?

It should be ok. Try some test maps to prove it to yourself if you are
worried. This is a well-trod path.

see also r.in.arc, r.out.arc.

The authors are well aware of the issue anyway, so I would be surprised
if it was wrong.

Hamish

I didn't know that grass referenced the lower left corner. I assumed
it was the cell center. Where is this documented?

David

On 12/3/05, Maciek Sieczka <werchowyna@epf.pl> wrote:

Hi

As we know, in ArcInfo grids the coordinates refer to the cell centre.
In Grass it is the bottom-left corner of the cell. Now, when I import an
ArcInfo binary grid into Grass using r.in.gdal, is it automatically
shifted half a pixel resolution to cope with this issue or not? How
about r.out.gdal when writing to an ArcInfo binary or ascii grid?

Best,
Maciek

--------------------
Historia, która przeros³a fikcjê. Chcesz poznaæ rozwi±zanie jednej z najwiêkszych tajemnic II wojny ¶wiatowej?
Przeczytaj BURSZTYNOW¡ KOMNATÊ, Catherine Scott-Clark, Adrian Levy
http://www.rebis.com.pl/rebis/strony/pokaz_ksiazke.html?id=32787

--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA 98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays

I didn't know that grass referenced the lower left corner. I assumed
it was the cell center. Where is this documented?

"The geographic boundaries of the raster file are described by the north,
south, east, and west fields. These values describe the lines which bound
the map at its edges. These lines do NOT pass through the center of the
grid cells at the edge of the map, but along the edge of the map itself."

(section 5.3.1 of the old GRASS 5 programmer's manual.)

I guess it should be added here? grass6/raster/rasterintro.html

In the GRASS 6 programmer's manual: ???
make pdfdocs
xpdf lib/gis/latex/grass61gis_2005_12_07_refman.pdf

It is mentioned in the r.in.ascii and r.in.bin help pages,
  http://grass.ibiblio.org/grass61/manuals/html61_user/r.in.ascii.html

Hamish

Maybe I misunderstood. I thought that you were referring to the
coordinates of an arbitrary cell value (x, y), not the bounding box of
the whole raster.

The only two raster registration systems that I have encountered are
"raster" where the cell's value is located at the center of the cell,
and "lattice" or "fishnet" where each corner of the cell has a value
(really, the intersection of row and column lines).

In the former, there are row * col values.
In the latter there are (rows + 1) * (cols +1) values.

You suggested that GRASS uses a variation on the "raster" format where
instead of the cell center, the lower-left corner was the location of
the value.

This is a 1/2 X 1/2 cell shift in coordinates from what I expected.
I've got a lot of code that is messed up if that is the case.

David

On 12/6/05, Hamish <hamish_nospam@yahoo.com> wrote:

> I didn't know that grass referenced the lower left corner. I assumed
> it was the cell center. Where is this documented?

"The geographic boundaries of the raster file are described by the north,
south, east, and west fields. These values describe the lines which bound
the map at its edges. These lines do NOT pass through the center of the
grid cells at the edge of the map, but along the edge of the map itself."

(section 5.3.1 of the old GRASS 5 programmer's manual.)

I guess it should be added here? grass6/raster/rasterintro.html

In the GRASS 6 programmer's manual: ???
make pdfdocs
xpdf lib/gis/latex/grass61gis_2005_12_07_refman.pdf

It is mentioned in the r.in.ascii and r.in.bin help pages,
  http://grass.ibiblio.org/grass61/manuals/html61_user/r.in.ascii.html

Hamish

--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA 98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays

David Finlayson wrote:

Maybe I misunderstood. I thought that you were referring to the
coordinates of an arbitrary cell value (x, y), not the bounding box of
the whole raster.

The only two raster registration systems that I have encountered are
"raster" where the cell's value is located at the center of the cell,
and "lattice" or "fishnet" where each corner of the cell has a value
(really, the intersection of row and column lines).

In the former, there are row * col values.
In the latter there are (rows + 1) * (cols +1) values.

You suggested that GRASS uses a variation on the "raster" format where
instead of the cell center, the lower-left corner was the location of
the value.

A cell's value is either a sample taken at the centre of the cell, or
the value for the cell as a whole, depending upon your perspective.
IOW, it's what you refer to as "raster" registration, and what GMT
refers to as "pixel" registration.

This is a 1/2 X 1/2 cell shift in coordinates from what I expected.
I've got a lot of code that is messed up if that is the case.

The bounds of a region (struct cell_hd) refer to the edges of the
region, i.e. the top-left corner of the top-left cell and the
bottom-left corner of the bottom-left cell.

Note that G_col_to_easting() and G_row_to_northing() take the col/row
as floating point values where (row,col) is the top-left corner,
(row+1,col+1) is the bottom-right corner, and (row+0.5,col+0.5) is the
centre. I.e. if you want the coordinates of the centre of the cell
with index (row,col), you would need to use:

  x = G_col_to_easting(col + 0.5, &wind);
  y = G_row_to_northing(row + 0.5, &wind);

where the top-left cell is (0,0) and the bottom-right cell is
(nrows-1,ncols-1).

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

On Wed, Dec 07, 2005 at 01:41:35PM +1300, Hamish wrote:

> I didn't know that grass referenced the lower left corner. I assumed
> it was the cell center. Where is this documented?

"The geographic boundaries of the raster file are described by the north,
south, east, and west fields. These values describe the lines which bound
the map at its edges. These lines do NOT pass through the center of the
grid cells at the edge of the map, but along the edge of the map itself."

(section 5.3.1 of the old GRASS 5 programmer's manual.)

I guess it should be added here? grass6/raster/rasterintro.html

done.

Markus

In the GRASS 6 programmer's manual: ???
make pdfdocs
xpdf lib/gis/latex/grass61gis_2005_12_07_refman.pdf

It is mentioned in the r.in.ascii and r.in.bin help pages,
  http://grass.ibiblio.org/grass61/manuals/html61_user/r.in.ascii.html

Hamish

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy