[mapserver-dev] Coloring height rasters

Frank Warmerdam warmerdam at pobox.com
Tue Nov 19 13:45:09 EST 2002

Administrator wrote:
> I would like the capability to map height rasters, read through GDAL, to 
> non grey scale RGBA values using a simple color ramp shader to produce 
> the final pixel values.  The target output image is an RGBA PNG file.
> Are there any suggestions regarding the proper way to implement such 
> functionality within mapserver ? 


My personal opinion is that the best way to do this is to preprocess
your data in an image processing package of some sort to get the results
you want without mapserver having to do any serious magic.

That said, I have just incorporated support into MapServer 3.7 (cvs) to
provide explicit or automatic scaling for non-eight bit data.  You could
now do something like the following to cause data to get scaled from 0-1000
down to 0-255, and then introduce CLASS statements for each entry you want
in the colormap.  If you really want smooth, that would be 256 but I think
having 32 classes would be roughly equivelent information for most purposes.

   NAME height
   TYPE raster
   STATUS default
   DATA data/height.tif
   CLASS ...

PS. I would like of like a way to generate a "range" color table for a
scaled raster within MapServer, but to make it really useful we also need
a mechanism to generate a corresponding scalebar properly labelled.  That
effort is beyond my scope for today. :-)

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-dev mailing list