python with anaconda .gdal version =2.2.2 libtiff version =4.09 ,Win 7 ,RAM =8G:
After update packages, I find my program doesn't work. In Anaconda prompt ,It shows ‘not definite GDAL_DATA’, So I add env variable with ‘%~dp0......\Library\share\gdal’ .Ok,It doesn't tell me ‘not definite GDAL_DATA’.But the program does not work ~~ :(
from osgeo import gdal
import numpy as np
ds = gdal.Open('G:\Soil_GridV2\Sand\SNDPPT_M_sl1_250m_ll.tif')
channel = np.array(ds.GetRasterBand(1).ReadAsArray())
and then :
from osgeo import gdal
import numpy as np
ds = gdal.Open('G:\Soil_GridV2\Sand\SNDPPT_M_sl1_250m_ll.tif')
channel = np.array(ds.GetRasterBand(1).ReadAsArray())
Traceback (most recent call last):
File "<ipython-input-18-343e96de9e31>", line 4, in <module>
channel = np.array(ds.GetRasterBand(1).ReadAsArray())
AttributeError: 'NoneType' object has no attribute 'GetRasterBand'**
So I check the Variable in spyder ,and find ds is None value.SO I guess the GDAL now broken can't open tiff? SO i try it again with a small tiff file(about 67.8 M) .successed! SO I find my GDAL can't open big Geo tiff file such as first file (about 2.15G)
So ,should I do to fix it or repalce it with other libs? :)
I Have solved it by update GDAL 2.2.4 with pip command. Note: Dont use conda update command ,because packages2.2.2 is not support big tiff.