Proof of Concept Gradient Coloring and Dev question

Bill Binko bill at BINKO.NET
Tue Apr 5 09:38:02 EDT 2005


On Tue, 5 Apr 2005, Frank Warmerdam wrote:

> On Apr 5, 2005 3:42 AM, Havard Tveite <havard.tveite at umb.no> wrote:
> > I agree that it would be nice to have a way of rendering
> > quantitative attributes in UMN Mapserver semi-automatically.
> > 
> > What about making the functionality more "general" by for
> > instance including the following STYLE items:
> > 
> > NUMBEROFCLASSES - the number of classes used (if not speficied,
> >                    a "continuous" rendering is performed).
> > BREAKS - The method of classification - "naturalbreaks",
> >           "equalinterval", "histogramequal", ... or the actual
> >           breakpoints ("1000,5000,7000,13000,21000,26000,29000").
>  
> Håvard,
> 
> While the idea of generalizing this to generating a set of 
> classes has merit, I don't think it is suitable when you 
> use Bill's method of putting the controls in a STYLE.  In
> fact, Bill's approach is to say that there would only be one
> class for gradient fill (what I would call color ramped) and that
> it is implemented as a specialized rendering style but STYLES
> are nested inside a single class.  So we can't very well have a
> class with a style that generates a set of classes.   At the very
> least it would be very confusing. 

One of the features I've considered (but haven't implemented yet) is an 
"INCREMENT" command.  That would allow you to provide a fixed numbers of 
colors and would be a simple modification.  I really like the continuous 
colors though, so I think the default for that would be "0". :)

Regarding how to break it up, I think a first pass would just let you do 
something like this:

STYLE
	MINCOLOR 0 0 0
	MAXCOLOR 255 255 0
	GRADIENTITEM "foo"
	MINVALUE 0.0
	MAXVALUE 100.0
	INCREMENT 20.0
END

That would give you 5 steps from black to yellow.

Another thing you should be aware of is that I'm using PostGIS layers as 
the data sources for these.  That lets me do 'real' manipulation of the 
data realtime before it gets mapped.  So I can do a complicated select 
that maps values to things like log scaling etc. and I don't have to add 
support into mapserver for it.  I just thought I'd mention it as there are 
some that might like a more flexible (and complicated) solution here.

> I certainly do like Bill's original approach for continuous gradient
> fill.  In addition to using it for the rendering, I would also like legends
> to know how to show a gradient fill styled class as a color ramp with
> min, max and perhaps some intermediate values.  Of course we will
> also need some control over how these legend entries are generated.

(Thanks!) I agree: legends are a must, and I have not even begun to look
at it.  If anyone has legend experience, please let me know!

I'm posting a patch to bug 1305 which I just created.  If anyone wants a 
copy, just email me.

Bill



More information about the mapserver-users mailing list