Proposed RFC on COLORRAMP Support (Bug 13 05)

Bill Binko bill at BINKO.NET
Tue Sep 27 16:30:04 EDT 2005


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