[Gdal-dev] AAIGrid driver reading Floating points incorrectly?
Christopher Condit
condit at sdsc.edu
Fri Jul 14 10:53:51 EDT 2006
Hi Bryan-
I think that GDAL uses a shortcut to decide on the AAIGrid data type.
Namely: scanning the first 100 bytes only and looking for any decimal
places. In your case it appears that the first line in all NODATA
(integers). I think if you change the first one of those to -99999.0
you should see a change in how the driver handles the file.
-Chris
-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Bryan Keith
Sent: Thursday, July 13, 2006 12:51 PM
To: gdal-dev at lists.maptools.org
Subject: [Gdal-dev] AAIGrid driver reading Floating points incorrectly?
I have a Float32 tif (see gdalinfo below) that I translate to a Float32
AAIGrid (see gdal_translate below). After the translation gdalinfo
reports the dataset as Int16 and reports the grid maximum vastly
different than it was before (see gdalinfo below). The output aaigrid
file is indeed floating point (see head output below) even though
gdalinfo says it's int16. When I translate this aaigrid back to a tif,
then the new gdalinfo tif report is the same as the gdalinfo aaigrid (I
didn't paste this stuff). When I translate the aaigrid to an ArcInfo
binary grid (AIG) using ArcInfo, then the output is the same as the
original tif. The gdalinfo report for the AIG dataset is the same as
the original tif. So it appears that the aaigrid writer is working
correctly, but the aaigrid reader isn't working as expected.
A bug or am I doing something wrong?
Bryan
>gdalinfo elkw_g.tif -mm
Driver: GTiff/GeoTIFF
Size is 174, 225
Coordinate System is:
Origin = (683628.000000,2280258.125000)
Pixel Size = (1640.00000000,-1640.00000000)
Metadata:
AREA_OR_POINT=Area
Corner Coordinates:
Upper Left ( 683628.000, 2280258.125) (116d 0'4.59"W, 41d 0'38.27"N)
Lower Left ( 683628.000, 1911258.125) (116d 0'40.36"W, 39d59'51.82"N)
Upper Right ( 968988.000, 2280258.125) (114d58'3.19"W, 41d 0'0.09"N)
Lower Right ( 968988.000, 1911258.125) (114d59'34.47"W, 39d59'14.98"N)
Center ( 826308.000, 2095758.125) (115d29'35.81"W, 40d30'0.47"N)
Band 1 Block=174x11 Type=Float32, ColorInterp=Gray
Computed Min/Max=1523.000,3385.788
NoData Value=-99999
>gdal_translate -of AAIGrid -ot Float32 elkw_g.tif elkw_g.asc
Input file size is 174, 225
0...10...20...30...40...50...60...70...80...90...100 - done.
>gdalinfo elkw_g.asc -mm
Driver: AAIGrid/Arc/Info ASCII Grid
Size is 174, 225
Coordinate System is:
Origin = (683628.000000,2280258.125000)
Pixel Size = (1640.00000000,-1640.00000000)
Corner Coordinates:
Upper Left ( 683628.000, 2280258.125) (116d 0'4.59"W, 41d 0'38.27"N)
Lower Left ( 683628.000, 1911258.125) (116d 0'40.36"W, 39d59'51.82"N)
Upper Right ( 968988.000, 2280258.125) (114d58'3.19"W, 41d 0'0.09"N)
Lower Right ( 968988.000, 1911258.125) (114d59'34.47"W, 39d59'14.98"N)
Center ( 826308.000, 2095758.125) (115d29'35.81"W, 40d30'0.47"N)
Band 1 Block=174x1 Type=Int16, ColorInterp=Undefined
Computed Min/Max=1523.000,31073.000
NoData Value=-99999
>head -n 7 elkw_g.asc
ncols 174
nrows 225
xllcorner 683628.000000000000
yllcorner 1911258.125000000000
cellsize 1640.000000000000
NODATA_value -99999
-99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -9
9999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -9999
9 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -
99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -999
99 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999
-99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -99
999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -99999
-99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -9
9999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -9999
9 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -
99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
-99999 -999
99 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999 -99999
1928.612915039
0625 1965.587158203125 1994.283447265625 2013.431396484375
1997.0623779296875 21
11.51416015625 2196.006103515625 2292.074951171875 2427.913818359375
2483.550048
828125 2456.762939453125 2558.080322265625 2680.93896484375
2807.83984375 2850.4
55810546875 3076.365234375 3124.860107421875 2905.718017578125
2704.766845703125
2457.794189453125 2327.631591796875 2239.057861328125 2135.4072265625
2071.9897
4609375 2032.28515625 1985.5416259765625 1948.4173583984375
1905.1170654296875 1
875.913818359375 1839.749755859375 1824.07958984375 1820.505126953125
1806.35302
734375 1767.8443603515625 -99999 -99999 -99999 -99999 -99999
Bryan Keith
GIS Specialist
Geomega, Inc.
Boulder, CO, USA
_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev
More information about the Gdal-dev
mailing list