[mapserver-dev] Coloring height rasters
jnovak at novacell.com
Sun Nov 24 01:01:05 EST 2002
If you have the capability to process raw data, and the capability to
quantize that data into a set of 255 user specified colors, you're
already touching every pixel in the raw data. A color ramp shader such
as I'm simply performs a different quantization and outputs 24 bit
values for each pixel.
I definitely agree that this is not the pinnacle of optimal code, but I
can have the shader use the full range of 24 bit color across the
heights appearing in the rectangle of interest. Maximum detail based on
the height minimum and maximum.
This, of course, begs the question of just where the height minimum and
maximums come from.
Which, conveniently, leads to my next question. There's already a very
fine tile based scheme that sits on top of the shape file data base
format, I believe. It seems that it would not be terribly difficult for
someone, namely me, to extend the row schema for each tile such that it
includes the min and max heights for the tile.
An appropriate tile index query could then supply the shader with the
height extrema for each tile in the final image so that the correct
ratio of height delta to pixel RGB value could be efficiently computed
for rendering. This means you may not get the broadest range of values
for a particular rectangle, but if the tile index has appropriate
granularity it should suffice.
Maybe I could implement the range color table while I'm at it...
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Tuesday, November 19, 2002 10:45 AM
Cc: mapserver-dev at lists.gis.umn.edu
Subject: Re: [mapserver-dev] Coloring height rasters
> I would like the capability to map height rasters, read through GDAL,
> 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.
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. :-)
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