[Mapserver-dev] Re: [Gdal-dev] MMS false color from 16-bit unsigned data?

Frank Warmerdam warmerdam at pobox.com
Fri Nov 21 16:40:10 EST 2003

Chris G. Nicholas wrote:
> I see in the MMS Raster HOW-TO "classification" section the note:
> "Some format drivers (ie. GDAL) cast the pixel values to the range 0 to 255 before applying the classification scheme to them"
> What's involved to address this issue; purely tweeks to mapgdal.c?  It would be extremely cool to apply these things on the fly to HDF slices and lossless jpeg2000 grayscales...


There is currently various ways of controlling how the data is scaled to
0 to 255, but the problem that the classification isn't being applied till
after the translation is still there.

To answer your question, the solution would all be local to mapgdal.c in
MapServer, but might require significant restructuring.  But the reason
I haven't done anything about this problem is that running a pixel value
through the classification process is relatively expensive.  Too expensive
to apply to on the order of a quarter million pixel values you might have in
a typical 500x500 map view.  So, instead we just apply the classification
scheme 256 times, to each value between 0 and 255 and remember the results.
Much faster.

But of course, as we see here, with 16bit data there would be 64K possible
values.  For floating point data there is no way of doing the tabular approach.

I don't really see what to do to produce acceptable performance for the
general case.  I am cc:ing mapserver-dev since this is really more of a
mapserver issue than a gdal one.

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