Proof of Concept Gradient Coloring and Dev question

Bill Binko bill at BINKO.NET
Tue Apr 5 10:35:37 EDT 2005


On Tue, 5 Apr 2005, Gerry Creager N5JXS wrote:

> I've gotta go back and look at the archives; I missed this on the first
> pass.  I've got the "lots of classes" solution when plotting
> precipitable water vapor and it's really messy.
>
> Do you have simple tutorial on what you're doing I could snag?  Please?!
>
> Thanks, Gerry

I tried to keep it simple, so here's a quick run-down.  Please remember,
this is not gospel and may be dropped/rewritten -- I've gotten no feedback
from Stephen Lime or others yet.

If you want to try this out and your using linux/unix/bsd/etc., go to the
bug at:

http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1305

Download the patch (gradient.patch.gz) and save it in your (virgin)
mapserver-4.4.1 source directory.

run:

$ zcat gradient.patch.gz | patch
$ make clean all

install as you normally do (in my case, I just copy the mapserv to my
cgi-bin directory).

Then you can add several new elements to your mapfiles:

STYLE
  GRADIENTITEM "fieldName" #Must be numeric (float/int)
  MINVALUE 0.0             #The low end of the data values
  MAXVALUE 100.0           #The hight end of the data values
  MINCOLOR 255 0 0         #A color to match low values
  MAXCOLOR 0 255 0         #A color to match high values
  COLOR 0 0 0              #A dummy color - some parts of the
                           #code won't draw without this
                           # - I'll fix it later :-)
END

If your value is lower than MINVALUE, it will get the MINCOLOR (likewise
for MAX).  Values between MIN and MAX will get mapped (linearly) between
the MINCOLOR and MAXCOLOR.

I find that using the Gimp to make some simple linear gradients helps me
pick good colors.

I'll add INCREMENT in the not too distant future and update the patch.

Bill



More information about the mapserver-users mailing list