[Mapserver-users] Mapserver 4.0 color issues

Frank Warmerdam warmerdam at pobox.com
Fri Aug 8 12:42:48 EDT 2003


Davis Michael A DPW GIS TECH wrote:
> I recently upgraded our mapserver sites to 4.0 using the windows binary. 
> 
> Since the upgrade I have noticed a strange anomaly, when displaying 
> grayscale imagery on the map all the layers change to grayscale.  When 
> the imagery layer is switched off everything returns to their normal 
> color schemes.
> 
> I am wondering if anyone has run into this issue before or has any ideas 
> for a fix.

Mike,

I am not exactly sure why this would have worked before, and not work now
but my guess is that your greyscale raster layer is "grabbing" all 256
available colors and when later stuff is drawn requesting different colors,
they end up having to settle for the closest grayscale color.

I would have expected the same thing to have happened in previous versions,
but there may have been some subtle changes in the order of operations
within mapserver that has made this problem worse.

One solutions would be to switch to 24bit png output so there is no color
limit.  However, assuming that is impractical, there is also a new option
in MapServer 4 for encouraging a raster layer to take less colors by
grouping very similar colors.  Try adding the COLOR_MATCH_THRESHOLD processing
option to your file:

LAYER
   NAME grey
   TYPE raster
   PROCESSING "COLOR_MATCH_THRESHOLD=3"
   STATUS default
   DATA data/grey.tif
END

However, I think it might be best if I just modified the greyscale rendering
code to merge adjacent greyscale values by default to avoid this. Thus
a 128 color greyscale palette would be implicitly used for greyscale layers
instead of grabbing for all 256 where possible as is done now.

In fact, I think I *will* commit that change in the MapServer 4.1 development
trunk.

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