[Mapserver-users] Mapserver 4.0 color issues

Davis Michael A DPW GIS TECH michael.davis at richardson.army.mil
Fri Aug 8 12:50:57 EDT 2003


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C35DCD.3D282D0B
Content-Type: text/plain

That fixed the problem, thanks a bunch.  

On a side note I think this is the fastest turn around I have ever seen on a
mailing list.  Gotta love the Mapserver community!

Mike Davis
GIS Specialist
Ft. Richardson, AK
1.907.384.0538


-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Friday, August 08, 2003 8:43 AM
To: Davis Michael A DPW GIS TECH
Cc: mapserver-users at lists.gis.umn.edu
Subject: Re: [Mapserver-users] Mapserver 4.0 color issues


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


------_=_NextPart_001_01C35DCD.3D282D0B
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2655.72">
<TITLE>RE: [Mapserver-users] Mapserver 4.0 color issues</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>That fixed the problem, thanks a bunch.&nbsp; </FONT>
</P>

<P><FONT SIZE=3D2>On a side note I think this is the fastest turn =
around I have ever seen on a mailing list.&nbsp; Gotta love the =
Mapserver community!</FONT></P>

<P><FONT SIZE=3D2>Mike Davis</FONT>
<BR><FONT SIZE=3D2>GIS Specialist</FONT>
<BR><FONT SIZE=3D2>Ft. Richardson, AK</FONT>
<BR><FONT SIZE=3D2>1.907.384.0538</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Frank Warmerdam [<A =
HREF=3D"mailto:warmerdam at pobox.com">mailto:warmerdam at pobox.com</A>]</FON=
T>
<BR><FONT SIZE=3D2>Sent: Friday, August 08, 2003 8:43 AM</FONT>
<BR><FONT SIZE=3D2>To: Davis Michael A DPW GIS TECH</FONT>
<BR><FONT SIZE=3D2>Cc: mapserver-users at lists.gis.umn.edu</FONT>
<BR><FONT SIZE=3D2>Subject: Re: [Mapserver-users] Mapserver 4.0 color =
issues</FONT>
</P>
<BR>

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

<P><FONT SIZE=3D2>Mike,</FONT>
</P>

<P><FONT SIZE=3D2>I am not exactly sure why this would have worked =
before, and not work now</FONT>
<BR><FONT SIZE=3D2>but my guess is that your greyscale raster layer is =
&quot;grabbing&quot; all 256</FONT>
<BR><FONT SIZE=3D2>available colors and when later stuff is drawn =
requesting different colors,</FONT>
<BR><FONT SIZE=3D2>they end up having to settle for the closest =
grayscale color.</FONT>
</P>

<P><FONT SIZE=3D2>I would have expected the same thing to have happened =
in previous versions,</FONT>
<BR><FONT SIZE=3D2>but there may have been some subtle changes in the =
order of operations</FONT>
<BR><FONT SIZE=3D2>within mapserver that has made this problem =
worse.</FONT>
</P>

<P><FONT SIZE=3D2>One solutions would be to switch to 24bit png output =
so there is no color</FONT>
<BR><FONT SIZE=3D2>limit.&nbsp; However, assuming that is impractical, =
there is also a new option</FONT>
<BR><FONT SIZE=3D2>in MapServer 4 for encouraging a raster layer to =
take less colors by</FONT>
<BR><FONT SIZE=3D2>grouping very similar colors.&nbsp; Try adding the =
COLOR_MATCH_THRESHOLD processing</FONT>
<BR><FONT SIZE=3D2>option to your file:</FONT>
</P>

<P><FONT SIZE=3D2>LAYER</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; NAME grey</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; TYPE raster</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; PROCESSING =
&quot;COLOR_MATCH_THRESHOLD=3D3&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; STATUS default</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp; DATA data/grey.tif</FONT>
<BR><FONT SIZE=3D2>END</FONT>
</P>

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

<P><FONT SIZE=3D2>In fact, I think I *will* commit that change in the =
MapServer 4.1 development</FONT>
<BR><FONT SIZE=3D2>trunk.</FONT>
</P>

<P><FONT SIZE=3D2>Best regards,</FONT>
</P>

<P><FONT SIZE=3D2>-- </FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------+-----------------------=
---------------</FONT>
<BR><FONT SIZE=3D2>I set the clouds in motion - turn up&nbsp;&nbsp; | =
Frank Warmerdam, warmerdam at pobox.com</FONT>
<BR><FONT SIZE=3D2>light and sound - activate the windows | <A =
HREF=3D"http://pobox.com/~warmerdam" =
TARGET=3D"_blank">http://pobox.com/~warmerdam</A></FONT>
<BR><FONT SIZE=3D2>and watch the world go round - =
Rush&nbsp;&nbsp;&nbsp; | Geospatial Programmer for Rent</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C35DCD.3D282D0B--



More information about the mapserver-users mailing list