I am trying to get the raster attribute table of the following file: Shift_cult_past_current_prediction_20160107_gr1DD.tif available here: https://www.dropbox.com/s/fmomfpro3j6dmz8/Shift_cult_past_current_prediction_20160107_gr1DD.tif?dl=0

Here is the code I am using:

import gdal
dataset = gdal.Open(dataset_uri) # dataset_uri is path to .tif file
band = dataset.GetRasterBand(1)
rat = band.GetDefaultRAT()

I am using gdal version 2.1.0 on python 2.7.11 (Mac and windows). However, while I get the raster attribute table on windows I get nothing on mac (10.9.5). What could I be doing wrong?


$ conda list | grep 'gdal'
gdal                      2.1.0               np111py27_1    conda-forge
  • 1
    How did you install GDAL 2.1.0 because I have no problem (Yosemite) – gene May 4 '16 at 20:17
  • I just did conda install gdal, not sure what I am missing here – user1186 May 4 '16 at 20:44
  • updated my question with what I get when I do conda list | grep 'gdal' – user1186 May 4 '16 at 20:45
  • @gene, does the additional information help? – user1186 May 10 '16 at 17:21
  • Have you installed QGIS from KyngChaos ? Working with Yosemite, GDAL 2.1 works with Conda Python 3.5, not with Conda Python 2.7.x. In this version I use the GDAL 1.11 of KyngChaos – gene May 10 '16 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.