[GRASSLIST:5646] Re: Grass raster vs ArcInfo grid

Maciek Sieczka werchowyna at pf.pl
Fri Feb 4 09:50:36 EST 2005


From: "Hamish" <hamish_nospam at yahoo.com>

>> AFAIK ArcInfo binary grid considers the middle of the cell as it's
>> origin,  while Grass raster the bottom left.
>>
>> Thus I guess there would be a positioning error of the ArcInfo bin
>> grid  imported into Grass 6.0 location. This error would be half the
>> AI grid cell  resolution. Plese let me know whether I'm right here or
>> not. If right, then  how to fix it/prevent it to happen?
>>
>> It also reffers to ASCII AI grid (right?), but one can simply help it
>> by  editing the 'xllcorner' and 'yllcorner' in the header.
>
>
> This difference is long known. (GRASS region coordinates are outside
> edge of border cells)
>
> Are r.in.arc, r.out.arc, &/or r.in.gdal giving you incorrect results?
>
> Hamish

Hamish

All here refers to ArcInfo 8.3.

It is a bit more complicated than I thought first, and I was looking for the 
guilty in a wrong place. My grids made in ArcInfo 8.3 are always shifted 
after importing to a grass location, but it happens because of ArcInfo, not 
GDAL or Grass. Below two differernt cases are presented. Could somebody 
suggest how to proceed to in order to import such AI grids so they are not 
shifted after importing into a Grass location?

Case 1.

When I make a TIN and convert it to a AI grid (within AI) the resulting
header is:

gdalinfo C:\WorkSpace\nieszko\tingrid


Driver: AIG/Arc/Info Binary Grid
Size is 604, 292
Coordinate System is `'
Origin = (733.526929,3875.290325)
Pixel Size = (10.00000000,-10.00000000)
Corner Coordinates:
Upper Left  (     733.527,    3875.290)
Lower Left  (     733.527,     955.290)
Upper Right (    6773.527,    3875.290)
Lower Right (    6773.527,     955.290)
Center      (    3753.527,    2415.290)
Band 1 Block=302x4 Type=Float32, ColorInterp=Undefined
  Min=6.131 Max=320.000
  NoData Value=-3.40282e+038

As you see the corner coordinates are rubbish and don't fit the resolution -
because the spatial extent of input TIN was preserved during conversion in
AI, instead of being transformed so that it corresponded with the grid
resolution. How can I load such a shifted grid so it is properly placed in a
Grass location?

Case 2.

A grid DEM made using TOPOGRID in ArcInfo. It's corner coords are set to
middle of the pixel.

gdalinfo C:\WorkSpace\exp10_on

Driver: AIG/Arc/Info Binary Grid
Size is 613, 323
Coordinate System is `'
Origin = (635.000000,4065.000000)
Pixel Size = (10.00000000,-10.00000000)
Corner Coordinates:
Upper Left  (     635.000,    4065.000)
Lower Left  (     635.000,     835.000)
Upper Right (    6765.000,    4065.000)
Lower Right (    6765.000,     835.000)
Center      (    3700.000,    2450.000)
Band 1 Block=307x4 Type=Float32, ColorInterp=Undefined
  Min=173.511 Max=346.385
  NoData Value=-3.40282e+038

I told the TOPOGRID to set the boundaries of the GRID to be a manifold of 10
(in the TOPGRID language - XYZLIMITS 640 840 6760 4060). Well, as expected,
the output corner coords are shifted to the middle of cells. Now, what is
the best approach to load this one into a Grass location having it placed
where it should be - the UL corner at 640 4060?

P.S.
I can convert the AI grid into AAI grid and fix the header manually in Case
2,  but I have no idea how to proceed with Case 1.

Maciek 




More information about the grass-user mailing list