Well elevation, particularly bathymetry, is an obvious application for
colourmaps for negative data. 

Marco, I deal with colourmaps with negative values using the <LUT> vrt
element instead of the <ColorTable> element.
See below, (note the data is a single band raster, but the VRT exands
this to 3 band RGB.

<VRTDataset rasterXSize="415" rasterYSize="340">
  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Red</ColorInterp>
    <ComplexSource>
      <SourceFilename relativeToVRT="1">test.bil</SourceFilename>
      <SourceBand>1</SourceBand>
      <LUT>
        -5:0,
        -4:25,
        -3:50,
        -2:75,
        -1:100,
        0:125,
        1:150,
        2:175,
        3:200,
        4:225,
        5:250
      </LUT>
    </ComplexSource>
  </VRTRasterBand>
  <VRTRasterBand dataType="Byte" band="2">
    <ColorInterp>Green</ColorInterp>
    <ComplexSource>
      <SourceFilename relativeToVRT="1">test.bil</SourceFilename>
      <SourceBand>1</SourceBand>
      <LUT>
        -5:0,
        -4:25,
        -3:50,
        -2:75,
        -1:100,
        0:125,
        1:150,
        2:175,
        3:200,
        4:225,
        5:250
      </LUT>
    </ComplexSource>
  </VRTRasterBand>
  <VRTRasterBand dataType="Byte" band="3">
    <ColorInterp>Blue</ColorInterp>
    <ComplexSource>
      <SourceFilename relativeToVRT="1">test.bil</SourceFilename>
      <SourceBand>1</SourceBand>
      <LUT>
        -5:0,
        -4:25,
        -3:50,
        -2:75,
        -1:100,
        0:125,
        1:150,
        2:175,
        3:200,
        4:225,
        5:250
      </LUT>
    </ComplexSource>
  </VRTRasterBand>
</VRTDataset>

Luke

-----Original Message-----
From: gdal-dev-boun...@lists.osgeo.org
[mailto:gdal-dev-boun...@lists.osgeo.org] On Behalf Of Frank Warmerdam
Sent: Friday, 25 June 2010 10:13 PM
To: Marco Stelluti
Cc: gdal-dev@lists.osgeo.org
Subject: Re: [gdal-dev] Modify an image color table?

Marco Stelluti wrote:
> Hi,
> I'm a new gdal user and I've a little problem.
> 
> I have to modify the color to an ASCII raster.
> 
> 1_ I converted the raster using gdalbuildvrt;
> 2_ I modified the file *.vrt adding:
>     <ColorInterp>Palette</ColorInterp>
>  <ColorTable>
> <Entry c1="255" c2="255" c3="255" c4="255"/>
> <Entry c1="0" c2="0" c3="150" c4="255"/>
> <Entry c1="0" c2="0" c3="150" c4="255"/>
> .......
>  </ColorTable>
> 3_ I know: "The entries are ordered and will be assumed to start from 
> color table entry 0"
> 4_ But I have some negative value on the ASCII raster, the range is
from 
> -31 to 65.
> 5_ How I can resolve this problem?

Marco,

Generally speaking GDAL color maps do not have an obvious application
to negative or non-integer data.  You could use the "raster attribute
table"
mechanism to represent color assignments to negative values, but since
so
few applications make use of this data object it is nearly useless to do
so.

What application do you want the color table to work in?  How you handle
the situation will depend on the output application.   If preserving the
original pixel values isn't important you may want to reprocess/rescale
your
raster.

Best regards,
-- 
---------------------------------------+--------------------------------
------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


------
If you have received this transmission in error please notify us immediately by 
return e-mail and delete all copies. If this e-mail or any attachments have 
been sent to you in error, that error does not constitute waiver of any 
confidentiality, privilege or copyright in respect of information in the e-mail 
or attachments. 



Please consider the environment before printing this email.

------

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to