Proposed RFC on COLORRAMP Support (Bug 13 05)

Bill Binko bill at BINKO.NET
Tue Sep 27 18:19:06 EDT 2005


On Tue, 27 Sep 2005, Ned Harding wrote:

> Personally I believe that the best way to generate breaks is to use a
> logarithmic StdDev and have natural breaks for -2.5, -1.5, -.5, .5, 1.5 and
> 2.5 * StdDev + Mean.  The breaks don't have an even # of items in them, but
> they convey the information in a very intuitive fashion.  If anyone wants
> help implementing such a thing, I would be glad to help with advice or even
> some code.
> 
> Maybe the best answer would be to create a separate API and system of
> helping people set up good breaks with MapServer.
> 

I think one thing that I will do right now is to incorporate something 
like the following into the RFC:

Multiple Mapping Methods
~~~~~~~~~~~~~~~~~~~~~~~~~

The system will allow new color mapping methods to be added with as little
effort as possible.  If a new color mapping method uses only the keywords 
defined by this RFC, it should be a simple as:

1) Implement a function with the signature 

int mappingFn(colorRangeObj* range, shapeObj* shape, colorObj *color)

This function should use the shape and range parameters to determine the 
shapes color, and modify the color parameter accordingly.

2) Choose a unique method name ('linear', 'logarithmic', 'discrete') 
modify the method msMapColorRamp() to call its method when its method name 
is found on a ColorRange definition.

Note: whether the msMapColorRamp() method uses if/then logic or dispatches 
by function pointer can be determined later.  For now, I believe the 
simplest approach would be to move all of the mapping logic + all current 
methods into a mapColorRange.c file.

Does that help?
Bill



More information about the mapserver-dev mailing list