Tuesday 26 April 2016

python - Did GDAL install correctly in Winpython?


I installed the "gdal-201-1800-core.msi" and "GDAL-2.1.2.win32-py3.4.msi" in WinPython. It looks like the gdal could run in python shell.( there is no error when type "import gdal" ). But I could not use any gdal function such as "GetRasterband()","ReadAsArray". what's wrong with the gdal?


import gdal

import ogr

file=gdal.Open(r'D:\GeoNE\temp\m2000049.tif')

band=file.GetRasterBand(1)
---------------------------------------------------------------------------

AttributeError Traceback (most recent call last)
in ()
----> 1 band=file.GetRasterband(1)

AttributeError: 'NoneType' object has no attribute 'GetRasterBand'


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...