Wishing we had COLORRAMPs or something

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Wed Jun 29 21:27:48 EDT 2005


Bill,

I don't seem to be able to get the color ramp to work, all I get is the 
first color in the ramp.

The attached images show what I get with the same CONNECTION and DATA 
strings but using classes vs the colorramp. "citem" is an integer from 0 
.. numclasses. Also, I note that I was unable touse %numclasses% on the 
DATARANGE.

I would lobby to have this mechanism be implemented at a global level 
and not on a line by line or item by item basis that it seems to be done 
now this would also facilitate the much requested #include feature. It 
should be doing simple text substitution before any parsing is done so 
any %variable% can just include abitrary text into the mapfile.


Here is the layer definition:

   LAYER
     NAME "zcta"
     CONNECTIONTYPE postgis
     CONNECTION "..."
     DATA "big honking sql stuff"

     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 "Class 0"
       EXPRESSION ([citem] = 0)
       OUTLINECOLOR 0 0 0
       COLOR 102 102 102
     END
     CLASS
       NAME "Class Ramp"
       COLOR   0 204   0
       STYLE
         COLORRANGE   0 255 0  255 0 0
  #       DATARANGE 1 %numclasses%
         DATARANGE 1 10
         RANGEITEM "citem"
       END
       OUTLINECOLOR 0 0 0
     END
   END

-Steve

Bill Binko wrote:
> On Wed, 29 Jun 2005, Stephen Woodbridge wrote:
> 
> 
>>Argggh! Doesn't look like it works in the version distributed at MUM3 in 
>>the workshops.
>>
>>MapServer version 4.6.0-beta3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG 
>>OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ 
>>SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT 
>>SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
>>  INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE 
>>DEBUG=MSDEBUG
>>
>>because it does not recognized the COLORRANGE
>>
> 
> 
> I would bet that it does.  I just looked at 4.6beta3, and you should be 
> able to use it as I said below.
> 
> Just a note, it must go into a STYLE...END block, it cannot go directly 
> into a CLASS (or LAYER).
> 
> Bill
> 
> 
>>-Steve W.
>>
>>Bill Binko wrote:
>>
>>>>Why is this needed? you ask, just make a bunch of classes.
>>>
>>>
>>>Mwuu ha ha  (*seang will kill me for this*) 
>>>
>>>Take a look at bug 1305, and see if that will fit your needs.
>>>
>>>It is close, but not exactly what you want.  Most obviously, legend 
>>>support is non-existant at this point, but I could be motivated to help 
>>>there if I ever get away from ECW and GeomUnion issues.
>>>
>>>If you're running 4.6, then support is already in there for you. 
>>>
>>>
>>>
>>>>For a thematic map, you can select the number of breaks you want to 
>>>>display, between 2 and 10 say. I already have code to compute the class 
>>>>breaks and to assign them a number between 0 and numclasses, now I need 
>>>>to a color in the ramp based on numclasses. If your ramp is RED from 0 
>>>>to 255, and you have a 2 class ramp the 2 will be 255, but if you 
>>>>display the same thin with a 10 class ramp 10 will be 255 and 2 will be 
>>>>like 25.5
>>>>
>>>
>>>
>>>In this case, you'd want to do something like this:
>>>
>>>	CLASS 
>>>		COLOR 0 0 0 #mapserver wants a default color 
>>>		STYLE
>>>			COLORRANGE 0 0 0 255 0 0 #start and end colors
>>>			DATARANGE 0 10 #start and end values
>>>			RANGEITEM "someField" #the field to use
>>>		END
>>>	END
>>>
>>>No doubt this is not perfect (it has no "breaks": it is continuous).  
>>>However, having another user try it and provide feedback (into the bug 
>>>please) can only help.
>>>
>>>Bill
>>>
>>
>>
>>
>>
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: classes.png
Type: image/png
Size: 27491 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050629/b8193dd5/classes.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: colorramp.png
Type: image/png
Size: 21164 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050629/b8193dd5/colorramp.png


More information about the mapserver-users mailing list