[gdal-dev] gdaldem color-relief does not produce any result

Cleo Drakos cleo21drakos at gmail.com
Fri Aug 22 07:48:29 PDT 2014


I have a geotiff file with class values (0, 1,  2, 3, and 4).
I want to show each class as different rgb color.

So, I created the text file (color_relief.txt) which contans the following:

0 55 78 94
1 98 23 64
2 112 35 99
3 34 67 72
4 78 250 60

Then I run the following code using python:

import subprocess
in_file =  'single_band.tif'
text_file = 'color_relief.txt'
gdaldem = 'C:\\Python27\\Lib\\site-packages\\osgeo\\gdaldem.exe'
out_file =  'result.tif'
subprocess.call([gdaldem
,'color-relif',in_file,text_file,out_file,'-exact_color_entry','-b','1'],shell=True)
in_file, out_file = None, None

Unfortunately, no result file is obtained.
What is wrong with my code?

cleo


On Fri, Aug 22, 2014 at 6:37 PM, Cleo Drakos <cleo21drakos at gmail.com> wrote:

> I have a single band geotiff file with discrete data in bytes.
> The unique data values are 0, 1,  2, 3, and 4.
> I want to intrepret each unique value as rgb color.
>
>  So, I created the text file (color_relief.txt) which contans the
> following:
>
> 0 55 78 94
> 1 98 23 64
> 2 112 35 99
> 3 34 67 72
> 4 78 250 60
>
> Then I run the following code using python:
>
> import subprocess
> in_file =  'single_band.tif'
> text_file = 'color_relief.txt'
> gdaldem = 'C:\\Python27\\Lib\\site-packages\\osgeo\\gdaldem.exe'
> out_file =  'result.tif'
> subprocess.call([gdaldem
> ,'color-relif',in_file,text_file,out_file,'-exact_color_entry','-b','1'],shell=True)
> in_file, out_file = None, None
>
> Unfortunately, no result file is obtained.
> What is wrong with my code?
>
> cleo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140822/5d217c8b/attachment.html>


More information about the gdal-dev mailing list