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