Proof of Concept Gradient Coloring and Dev question

Bill Binko bill at BINKO.NET
Mon Apr 4 14:27:19 PDT 2005


Hi everyone,

I have just implemented a quick hack to add gradient coloring to mapserver
4.4.1.  This was just an itch I was scratching, but I'd be happy to feed
it back into the code.  My main question here is how do I do that: is
there a CVS repository?  Do I mail in patches?  To whom?

Regarding the gradient coloring, it works like this:  you choose a numeric
field in your data (I've tested with PostGIS, but anything you can use for
classitem or labelitem should work), and create a style like this:

STYLE
  COLOR 60 60 60
  MINCOLOR 0 0 0
  MAXCOLOR 255 255 0
  MINVALUE 0.0
  MAXVALUE 300000.0
  GRADIENTITEM "sale_price"
END

That takes the sale_price field from the shapes values, maps its value to
a percentage between MINVALUE and MAXVALUE and then picks the color that's
appropriate from the color range.

For a quick snapshot of how this looks, I've mapped relative size of
parcels (as a percentage) to these colors:

                MINCOLOR 127 29 200 #Purple
                MAXCOLOR 255 255 0  #Yellow

You can see the results here: http://www.binko.net/gradient.png

As I said, this is still in the proof of concept stage, and I haven't
tested against any rendering except GD (although in theory it should
work).

Any help on future direction and how to contribute back would be
appreciated.

Bill



More information about the MapServer-users mailing list