Why can’t GDAL open big geo Tiff?
python with anaconda .gdal version =2.2.2 libtiff version =4.09 ,Win 7 ,RAM =8G:
After updating the package, I found that my program is not working anymore. In the Anaconda prompt, it says “Indeterminate GDAL_DATA”, so I added an environment variable with “%~dp0…\Library\share\gdal”. Ok, it didn’t tell me “not sure about 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 looked at Variable in spyder and found that ds is the None value. So I’m guessing GDAL is broken now and can’t open tiff? So I tried again with a small tiff file (about 67.8 M). It worked! So I found that my GDAL can’t open large Geo tiff files
For example, the first file (about 2.15G).
So, should I fix it or replace it with a different library? 🙂
Solution
I’ve fixed this issue by updating GDAL 2.2.4 with pip command. Note: Do not use the conda update command because packages2.2.2 does not support big tiff.