[FWTools] Opening ArcInfo Binary Grid with GDAL python
David Fawcett
david.fawcett at gmail.com
Fri Apr 18 15:27:57 EDT 2008
I am trying to use a bit of code from Matt Perry to sample an ArcInfo binary
grid. I am on Windows with FWTools 2.1.0. I can't seem to be able to open
the file.
I am assuming that I am not properly pointing to the file or not correctly
indicating what the format is. I believe that the path is properly written
with the escaped slashes.
Any help is appreciated.
David.
If I hit the file with gdalinfo, the results look good.
V:\elevation\national_elevation_dataset\ned30>gdalinfo mn_ned
Driver: AIG/Arc/Info Binary Grid
Files: mn_ned
mn_ned.aux
mn_ned.rrd
mn_ned\dblbnd.adf
mn_ned\hdr.adf
mn_ned\log
mn_ned\metadata.xml
mn_ned\prj.adf
mn_ned\sta.adf
mn_ned\vat.adf
mn_ned\w001001.adf
mn_ned\w001001x.adf
Size is 19063, 21868
Coordinate System is:
PROJCS["UTM Zone 15, Northern Hemisphere",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AXIS["Lat",NORTH],
AXIS["Long",EAST],
AUTHORITY["EPSG","4269"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",-93],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["METERS",1]]
Origin = (189768.816500588900000,5472357.859197510400000)
Pixel Size = (30.000000000000000,-30.000000000000000)
Corner Coordinates:
Upper Left ( 189768.817, 5472357.859) ( 97d16'11.64"W, 49d19'29.92"N)
Lower Left ( 189768.817, 4816317.859) ( 96d49'59.35"W, 43d26'7.78"N)
Upper Right ( 761658.817, 5472357.859) ( 89d23'49.61"W, 49d20'51.83"N)
Lower Right ( 761658.817, 4816317.859) ( 89d45'57.50"W, 43d27'14.51"N)
Center ( 475713.817, 5144337.859) ( 93d18'58.43"W, 46d27'7.83"N)
Band 1 Block=256x4 Type=Int16, ColorInterp=Undefined
Min=180.000 Max=700.000
NoData Value=-32768
Overviews: 4764x5465, 2381x2731, 1189x1364, 593x681, 295x339, 146x168,
72x83,
35x40
Metadata:
LAYER_TYPE=athematic
________________________
When I try to open the same file using gdal python, I get the error:
Here is the code snippet:
ds = gdal.Open(datasource)
if ds == None:
print"can't open it"
band = ds.GetRasterBand(bandnum)
>python getElevOs.py 567760 4898451
'v:\\elevation\\national_elevation_dataset\\ned30\\mn_ned'
ERROR 4: `'v:\\elevation\\national_elevation_dataset\\ned30\\mn_ned'' does
not exist in the file system,
and is not recognised as a supported dataset name.
can't open it
Traceback (most recent call last):
File "getElevOs.py", line 39, in ?
rasterval = getRasterValue( float(sys.argv[1]), float(sys.argv[2]),
sys.argv
[3])
File "getElevOs.py", line 17, in getRasterValue
band = ds.GetRasterBand(bandnum)
AttributeError: 'NoneType' object has no attribute 'GetRasterBand'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20080418/1b3499a3/attachment.html
More information about the FWTools
mailing list