Proof of Concept Gradient Coloring and Dev question

Bill Binko bill at BINKO.NET
Tue Apr 5 10:53:13 EDT 2005


On Tue, 5 Apr 2005, Sean Gillies wrote:

> As I told Frank on IRC yesterday, I'm concerned that eventually users
> will want this continuous style feature applied to outline colors, font
> colors, font sizes, symbol sizes, and so on.  The mapserver style could
> become an unwieldy object, and user data could become littered with
> *ITEM fields.  I assert that there is nothing demonstrated here by Bill
> Binko that can't be accomplished by N classes and simple legend
> filtering.  These N classes and filtered legends wouldn't have to be
> edited by hand, they could be generated using any flavor of mapscript.
> Don't take this the wrong way, Bill, I'm not dissing your creativity
> and hard work.  I'm not actively opposed, just wanting to make sure
> that unintended consequences are considered.

(First, don't worry: I'm hard to offend :)

It's interesting: the very first thing I tried to do with mapserver was
get things go "paint by number".  I had a dataset from the state of
Florida with "average daily traffic" and I wanted to get roads to color
accordingly.  I was actually very surprised to find that there was no way
to use the values in the data to color the shapes.  I later figured out
classes and the expressions there, but to get a decent display, I had to
have 25 classes in my layer!  Since my map had 12 layers, this was NUTS!

I'm sure there are currently solutions to this: I just think this works,
and makes life much simpler.  To claim that this will make mapfiles
unwieldy seems a bit backward: doing this now is clumsy.

That said, I'm open to suggestions on better ways to structure the file
elements!  Originally, I was going to change the existing COLOR element to
allow you to use data fields and expressions in the RBG(A) values.  That
was very flexible, but doing the basics became complicated:

MINCOLOR 255 0 0
MAXCOLOR 0 0 255
MINVALUE 1
MAXVALUE 3
GRADIENT "foo"

became:

COLOR (255+((0-255)*[foo](3-1))) 0 (0+((255-0)*[foo](3-1)))

It works, but it's tough to explain (I practice these on my wife :)  It's
also quite a bit harder to implement than what I have done.

>
> Additionally, "gradient fill" is not the right term to use for this new
> concept.  A gradient fill is generally understood to be the painting of
> a single polygon or region with a smoothly varying color.  I know you
> understand, Frank, I am just pointing out that it would be best to head
> off possible confusion.

I'm not attached to the word gradient: I just based it on the Gimp tool
that I used for picking colors.  Color-ramp seems to have been bandied
about earlier (although I'm not a huge fan of that one either :).

Again, I did this to make my maps work: I'm not picky about when/how/if it
makes it into the main distribution.  I'm just trying to give back. :)

Bill



More information about the mapserver-users mailing list