Proposed RFC on COLORRAMP Support (Bug 13 05)
Bill Binko
bill at BINKO.NET
Tue Sep 27 17:06:01 EDT 2005
Steve,
Before I comment on this, just a quick question: what do you think the
legend entry for that class would look like?
Bill
On Tue, 27 Sep 2005, Steve Lime wrote:
> The runtime substitution does not work everywhere- that's another RFC. Adding
> support for the breaks specifically is doable with this RFC though.
>
> How do COLORRAMPS and STYLES interact? Steve's example uses old-style code
> for styling. For example, let's say I want to draw a circle with graduated colors and
> also a drop shadow. Typicall I'd do this with 2 styles: 1 for the shadow (offset a bit)
> and the second for the main circle. How do you determine which take advantage
> of the color ramp.
>
> Working off that, what about defiining ramps at the layer level and then referencing
> the ramps by name wherever a COLOR is passed. That way label colors as well as
> symbol colors could take advantage of ramps. We'd need a way to indicate that a
> color is actually a reference to a color ramp, and then a function to return a color.
> We definitely don't want to have to keep adding new ramp keywords...
>
> A mapfile snippet might look like:
>
> LAYER
> COLORRAMP
> NAME 'ramp1'
> ...
> END
> COLORRAMP
> NAME 'ramp2'
> ...
> END
>
> CLASS
> STYLE COLOR 181 181 181 OFFSET 1 1 END
> STYLE COLOR 'ramp1' END
> LABEL COLOR 'ramp2' END
> END
> END
>
> Steve
>
> >>> Bill Binko <bill at BINKO.NET> 09/27/05 3:30 PM >>>
> Stephen, I thought your example would be a good test case to show how you
> would get what you wanted using the ColorRamp as defined in the RFC.
> I'm sure it's not 100% what you'd like, but it's fairly close.
>
> It does make an assumption that the %% substitution works everywhere, and
> I'll make sure to add that to the RFC. It also produces a legend that is
> a bit different from yours, in that it puts the demographic name on the
> first class, and then just the high/low values in the graded color bar
> (see http://mapserver.gis.umn.edu/bugs/attachment.cgi?id=324&action=view )
>
> Please use this as a starting point, and explain what won't work. There
> may very well be some additional work on the legends that is needed, but I
> think the general need you're expressing is addressed.
>
> Bill
>
> LAYER
> NAME "zcta_thematic"
> CONNECTIONTYPE postgis
> CONNECTION "host=linus port=5432 dbname=census user=pgsql"
> DATA "the_geom from (SELECT c.gid, c.the_geom, c.water, a.%demographic% as demog from %table% a,
> sf3geo_zcta5 b, zcta c where c.state='%state%' and c.name=b.zcta5 and
> a.stusab=b.stusab and a.logrecno=b.logrecno and b.stusab='%state%' and
> b.sumlev='871' ) as foo using srid=4326 using unique gid"
> TYPE POLYGON
> STATUS ON
> PROJECTION
> #"proj=latlong"
> "init=epsg:4326"
> END
> CLASSITEM "water"
> CLASS
> NAME "Water"
> EXPRESSION "t"
> OUTLINECOLOR 102 102 204
> COLOR 102 102 204
> END
> CLASS
> NAME "%demog%"
> EXPRESSION ([demog] > %break0% && [demog] <= %break1%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 102 102 102
> MAXCOLOR 0 204 0
> MINVALUE %break0%
> MAXVALUE %break1%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break1% && [demog] <= %break2%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 0 204 0
> MAXCOLOR 51 255 51
> MINVALUE %break1%
> MAXVALUE %break2%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break2% && [demog] <= %break3%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 0 204 0
> MAXCOLOR 102 255 102
> MINVALUE %break2%
> MAXVALUE %break3%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break3% && [demog] <= %break4%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 102 255 102
> MAXCOLOR 153 255 153
> MINVALUE %break3%
> MAXVALUE %break4%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break4% && [demog] <= %break5%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 153 255 153
> MAXCOLOR 204 255 204
> MINVALUE %break4%
> MAXVALUE %break5%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break5% && [demog] <= %break6%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 204 255 204
> MAXCOLOR 255 294 294
> MINVALUE %break5%
> MAXVALUE %break6%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break6% && [demog] <= %break7%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 255 294 294
> MAXCOLOR 255 153 153
> MINVALUE %break6%
> MAXVALUE %break7%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break7% && [demog] <= %break8%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 255 153 153
> MAXCOLOR 255 102 102
> MINVALUE %break7%
> MAXVALUE %break8%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break8% && [demog] <= %break9%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 255 102 102
> MAXCOLOR 255 51 51
> MINVALUE %break8%
> MAXVALUE %break9%
> RANGEITEM 'demog'
> END
> END
> CLASS
> NAME " "
> EXPRESSION ([demog] > %break9% && [demog] <= %break10%)
> OUTLINECOLOR 0 0 0
> COLORRANGE
> MINCOLOR 255 51 51
> MAXCOLOR 255 0 0
> MINVALUE %break9%
> MAXVALUE %break10%
> RANGEITEM 'demog'
> END
> END
> END
>
>
More information about the mapserver-dev
mailing list