[GRASSLIST:9409] ArcInfo grid shifted from Grass raster - why?

Maciek Sieczka werchowyna at epf.pl
Sat Dec 10 05:27:08 EST 2005


ArcInfo grids imported into Grass are shifted from the rasters created
in the same mapset, in the same resolution, using eg. r.mapcalc. I can't
understand why. Myabe it is the way it should be, but looks strange. Can
somebody explain it please? Whole the story step by step:

THE INPUT:

maciek at sorbus:~$ gdalinfo /media/cdrom0/13_nmt/model/dem_5/
Driver: AIG/Arc/Info Binary Grid
Size is 7930, 6305
Coordinate System is `'
Origin = (4732927.550000,5316649.800000)
Pixel Size = (5.00000000,-5.00000000)
Corner Coordinates:
Upper Left  ( 4732927.550, 5316649.800)
Lower Left  ( 4732927.550, 5285124.800)
Upper Right ( 4772577.550, 5316649.800)
Lower Right ( 4772577.550, 5285124.800)
Center      ( 4752752.550, 5300887.300)
Band 1 Block=496x4 Type=Float32, ColorInterp=Undefined
  Min=434.001 Max=1346.064
  NoData Value=-3.40282e+38



# I have r.in.gdal'ed it into "dem_5" in Grass:

r.info -s dem_5
nsres=5
ewres=5
r.info -g dem_5
north=5316649.8
south=5285124.8
east=4772577.55
west=4732927.55



THE PROBLEM:

dem_5 cells are shifted compared to the Grass raster cells in the same
resolution.



HOW TO NOTICE IT:

# 1. set the region to cover whole imported ArcInfo grid:

g.region rast=dem_5 res=5 -ap
north:      5316650
south:      5285120
west:       4732925
east:       4772580
nsres:      5
ewres:      5
rows:       6306
cols:       7931


# 2. zoom to a small part on the border of the dem_5 - until single
# cells are well visible:

d.rast dem_5
d.zoom 
g.region -p
north:      5295630
south:      5295550
west:       4770560
east:       4770645
nsres:      5
ewres:      5
rows:       16
cols:       17
(see AIG.png for illustration)


# 3. create a Grass raster in the same region

r.mapcalc 'test=dem_5'
r.colors test rules=grey
d.erase; d.rast test; d.rast -o dem_5
# all looks ok, the Grass native "test" covers the AIG "dem_5" perfect


# 4. yet, if I set a higher resolution to catch subtle differences...

g.region res=0.1 -ap
north:      5295630
south:      5295550
west:       4770560
east:       4770645
nsres:      0.1
ewres:      0.1
rows:       800
cols:       850

# 5. ...and re-display both layers...

d.erase; d.rast test; d.rast -o dem_5

# 6. ... it becomes visible that the Grass "test" doesn't fall into the
# same cells as the AIG "dem_5"

See the attached AIGvsGRASSshift.png. The grey background is the Grass
raster created with r.mapcalc (see point 3), the cyan overlay is the
binary AIG imported into Grass. And the shift of Grass raster vs AIG
grid is, as d.measure says, 0.2m North 2.5m West.

Is it OK? Why don't the imported AIG grid cells fall into exactly the
same "slots" as cells created in the same mapset using r.mapcalc?

Cheers,
Maciek


--------------------
Sprzêt audio, caraudio, wideo, o¶wietlenie, nag³o¶nienie estradowe,
telewizja satelitarna i wiele innych!!!
U nas najlepsze ceny - zajrzyj koniecznie --------> www.alder.com.pl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AIG.png
Type: image/png
Size: 4364 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20051210/1c883627/AIG.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AIGvsGRASSshift.png
Type: image/png
Size: 4480 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20051210/1c883627/AIGvsGRASSshift.png


More information about the grass-user mailing list