[mapserver-users] Classifying Rasters

Stephen Lime steve.lime at dnr.state.mn.us
Thu Jun 28 00:48:03 EDT 2001


Just to clarify. Classitem is not required. I stepped through the code (it's been awhile) and found no references in the raster code to classitem. There is a test in the map file reader that catches multiple classes with no classitem. Since classitems play a less significant role with logical expressions and rasters I've disabled that test until I can replace it with something more foolproof. Classification is triggered by the presence of classes, that's it.

[pixel] is correct for 3.5, and [value] for previous versions. Note that expression subsitutions are ALWAYS case sensitive. It just slows things down too much otherwise.

Frank's example is correct.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Frank Warmerdam <warmerdam at pobox.com> 06/27/01 21:05 PM >>>
Folks, 

Earlier this month there was a discussion of how to classify rasters.  I am
trying the suggestions with the current MapServer in CVS but I have had
problems.  After stepping through the code I have come to the following
assumptions:

 o the CLASSITEM declaration is still required, but the passed argument
   is ignored. 

 o The CLASS EXPRESSION statements must used "[pixel]" for the value, not
   "[VALUE]" as previously suggested.  Note that not even "[PIXEL]" will work

The following is an example of a goofy classification of a raster that works.

LAYER
  NAME "JacksonvilleNC_CIB"
  DATA "jacksonville.tif"
  TYPE RASTER
  STATUS ON
  # METADATA object
  METADATA
   "wms_title" "10meter CIB"
   "wms_extent" "-78 34 -77 35"
   "wms_resx" "0.000090"
   "wms_resy" "0.000090"
  END

  CLASSITEM "junk"
  CLASS
    EXPRESSION ([pixel] < 64)
    COLOR 0 0 0
  END
  CLASS
    EXPRESSION ([pixel] > 64 AND [pixel] < 128)
    COLOR 255 0 0 
  END
  CLASS
    EXPRESSION ([pixel] > 128 AND [pixel] < 196)
    COLOR 0 255 0 
  END
  CLASS
    EXPRESSION ([pixel] > 196 AND [pixel] < 256)
    COLOR 0 0 255
  END
END

Note that all this relates to 3.5 code base in CVS.  I don't know how things
worked in 3.4.  I am writing this up as part of a raster howto targetted
at 3.5.   If my assumptions are wrong please correct me.   I would like to
suggest that the CLASSITEM not be required for raster layers. 

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the mapserver-users mailing list