[gdal-dev] SetColorTable() issues on GTiff with python bindings

Ivan Lucena ivan.lucena at princeton-ma.us
Thu Sep 27 07:29:47 PDT 2012


Have you tried with GDT_Byte data type?

>  -------Original Message-------
>  From: Ingmar N <initze at ucc.ie>
>  To: gdal-dev at lists.osgeo.org
>  Subject: [gdal-dev] SetColorTable() issues on GTiff with python bindings
>  Sent: Sep 27 '12 09:12
>  
>  Hello,
>  I would like to add a Colortable to a GeoTiff. Running the SetColorTable()
>  function, python returns "3". GetColorTable() returns empty, no colortable
>  is attached.
>  After browsing the internet for a solution, I tried to run the procedure on
>  a newly created GTiff (which was often suggested). Probably any issues with
>  the colortable?
>  The file is not Write-protected or problematic otherwise, WriteArray() for
>  example works without any problem.
>  
>  
>  ds2=dr.Create('C:\\testfolder\\X.tif',ds.RasterXSize,ds.RasterYSize,1,gdal.GDT_Int16)
>  ct=gdal.ColorTable()
>  ct.CreateColorRamp(0,(178,223,138),5,(255,127,0))
>  outband=ds2.GetRasterBand(1)
>  outband.SetColorTable(ct) # returns 3
>  
>  Versions:
>  python 2.7
>  gdal 1.9.1
>  
>  Any Suggestions?
>  Thanks for your help
>  
>  
>  
>  --
>  View this message in context: http://osgeo-org.1560.n6.nabble.com/SetColorTable-issues-on-GTiff-with-python-bindings-tp5004969.html
>  Sent from the GDAL - Dev mailing list archive at Nabble.com.
>  _______________________________________________
>  gdal-dev mailing list
>  gdal-dev at lists.osgeo.org
>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>  


More information about the gdal-dev mailing list