[mapserver-users] How to specify the nodata index to be used when outputting a PC256 GTiff with GDAL/GTiff dirver

Gosselin, Andre Andre.Gosselin at dfo-mpo.gc.ca
Mon Dec 15 15:24:43 PST 2008


Hi,

I have a LAYER based on a gtiff file reported as follows by gdalinfo :

  Band 1 Block=10800x1 Type=Byte, ColorInterp=Palette
  NoData Value=255
  Color Table (RGB with 256 entries)
    0: 255,0,255,255
    1: 250,0,255,255
    2: 240,0,255,255
    3: 230,0,255,255
      (snip)
  253: 143,0,0,255
  254: 140,0,0,255
  255: 0,0,0,255

I would like Mapserver to produce a gtiff output with the same palette
as the above one, eg with 
255 as the nodata value. I just cannot see how to do that. Whatever I
try,
it appears that the missing value is always assigned to palette index 0
in the
output tiff file. For ex. here is what gdalinfo reports for the output
file :

    Band 1 Block=1000x8 Type=Byte, ColorInterp=Palette
    Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 255,0,255,255
    2: 250,0,255,255
    3: 240,0,255,255
    (snip)
  252: 150,0,0,255
  253: 147,0,0,255
  254: 143,0,0,255
  255: 140,0,0,255

Note that there is no explicit "NoData Value= "  indication. The input
color palette has been "shifted down" by one position, with the former
"255:0,0,0,255" entry now at top as "0: 0,0,0,255".
This annoying, because the byte values in the output tiff file do not
match anymore those in the input file.

Is there away to avoid this problem (except requiring all my source tiff
layers to be rewritten to use 0 as the nodata value instead of 255,
which would be a big pain given their high number).

Regards,

Andre Gosselin
Maurice Lamontagne Institute
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081215/74d33028/attachment.htm>


More information about the MapServer-users mailing list