[gdal-dev] Raster Color map in python

kalu671 kalu671 at gmail.com
Sun May 18 08:55:49 PDT 2014


I have a reference raster map and list of other rasters. I want to get color
table from reference map and set to the list using python. I can read other
parameters from raster but some how I can not get the color table
(GetRasterColorTable())from the source file, let alone setting the table
(SetRasterColorTable())to the list. I am pasting some code lines here. Could
someone help me figuring this out? or suggesting another easy solution?

There is another similar thread but that is related to C#. I tried to follow
that in python but didn't help.

SourceFile = "source.tif"
targetFile = "target.tif"

rastDriver    = gdal.GetDriverByName('gtiff')
rastDriver.Register()

inSourceFile   = gdal.Open(SourceFile)
inTargetFile   = gdal.Open(targetFile)

## reading parameters of source file
col 		= inSourceFile.RasterXSize
row		= inSourceFile.RasterYSize
bands	 	= inSourceFile.RasterCount
ct	        = inSourceFile.GetRasterColorTable() # the code stops working
from this line if I comment out        this line the code goes through
GeoT 		= inSourceFile.GetGeoTransform()
proj 		= inSourceFile.GetProjection()


Thank you in Advance for your help






--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Raster-Color-map-in-python-tp5141027.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list