Ticket #1305 (assigned enhancement)
(Prelim) Gradient Support for Mapserver 4.4.1
| Reported by: | bill@… | Owned by: | sdlime |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.6 release |
| Component: | MapServer CGI | Version: | 4.6 |
| Severity: | minor | Keywords: | |
| Cc: | woodbri@…, sgillies@…, mapserver@…, mko, sholl, havatv, jmckenna |
Description (last modified by sdlime) (diff)
As I posted on the mapserver-users list, I have put together a hack to get
gradient colors from a single style. Here is the post:
...
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).
I have gotten some feedback from the -users group, but I'd appreciate any from
the core developers. I will post a patch against 4.4.1 as well.
Bill
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

