[Gdal-dev] tiff creation with a colormap ?

Didrik Pinte dpinte at itae.be
Fri May 5 10:44:14 EDT 2006


Hi, 

Little technical question. I have (x,y,z) raster that i'm outputting to
a GeoTiff file with the following code :

driver_options = ['TFW=YES' 'COMPRESS=DEFLATE']
dst_ds = driver.Create( filename, len(self.idx['X']),\
                            len(self.idx['Y']), 1, gdal.GDT_Byte,\
                            driver_options )
[... coord sys lines ...]
dst_ds.GetRasterBand(1).WriteArray( numpy.transpose(raster) )

This creates a great raster in levels of gray.

Used to matplotlib, how can I output this raster with a colormap [1]? Do
I have to generate three bands ?

Many thanks for your help

Didrik

[1] here is an example of what i get with matplotlib :
http://itae.be/downloads/intrusion2.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20060505/e0ee82e6/attachment.bin


More information about the Gdal-dev mailing list