[mapserver-users] How to specify the nodata index to be used when outputting a PC256 GTiff with GDAL/GTiff dirver
Alexander Petkov
greenkov at gmail.com
Mon Dec 15 20:54:51 PST 2008
On Mon, Dec 15, 2008 at 4:24 PM, Gosselin, Andre
<Andre.Gosselin at dfo-mpo.gc.ca> wrote:
> 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
Hi Andre:
How did you get Mapserver to produce a paletted Gtiff output image?
Are you making a WMS GetMap request? I am trying to preserve the
palette in a WCS GetCoverage request without success (I get a
grayscale image), and I am interested in your solution. Also, how have
you configured the output format in your .map file?
Thanks in advance,
Alex
More information about the MapServer-users
mailing list