Display GeoTIFF-data (>8bit) with the Mapserver

Frank Warmerdam fwarmerdam at GMAIL.COM
Wed Mar 30 09:33:12 EST 2005


On Wed, 30 Mar 2005 14:18:01 +0200, Wolfgang Qual
<Wolfgang.Qual at muenchen.de> wrote:
> We purchased IKONOS-Satellite images (data format GeoTIFF, 16bit) and
> would like to get it into a mapserver map. However, this data is not
> supported by the mapserver. We got the error message:
> "drawTIFF(): Image handling error. Only 1, 4, and 8-bit images are
> supported."
> Tried to make a 8bit GeoTIFF of it using the gdal-utility rgb2pct.py,
> but it just produced strange results (strange colors).

Wolfgang,

I would suggest you first use gdal_translate to convert the data
to 8bit with scaling.  Something like this should do the trick:

  gdal_translate -scale -ot Byte ikonos_in.tif ikonos_out.tif

Depending on the form you got your dataset, you may also find
you want to reorder the bands for more normal viewing.  I believe
some datasets are distributed in BGRN format (blue, green, red, near-ir).
If you have that the colors will be pretty odd, but organizing it as
RGB may help:

eg.

  gdal_translate -scale -ot Byte -b 3 -b 2 -b 1 bgrn.tif rgb.tif

You may need to review your metadata to see what bands you have.

Once you have scaled to 3 8bit bands and are happy with the result you can
convert to pseudocolored format with rgb2pct.py if you wish.

> Anybody there, who managed it to put such data into a mapserver map? How
> can I produce a nice 8-bit image of the data without losing the
> information of the satellite image?

I would add that it seems your MapServer was built without GDAL support.
If you build in GDAL support, you can directly render from the IKONOS
files.  You will need to scale your data still but MapServer can do this
for you.  You can also reorder the data.  Something like:

  LAYER
      NAME IKONOS
      DATA mydatafile.tif
      PROCESSING "SCALE=AUTO"
      PROCESSING "BANDS=3,2,1"
  END

You may find you want an RGB output format like PNG24 or JPEG
to get decent color results.

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



More information about the mapserver-users mailing list