[mapserver-users] publish raster with integer pixel values

Alexander Petkov greenkov at gmail.com
Mon Dec 13 15:13:08 EST 2010


On Mon, Dec 13, 2010 at 11:16 AM, Simone Frigerio
<simone.frigerio at univie.ac.at> wrote:
> Yes of course Alex,
> sorry I didn't include in the example. I can generate pixel geolocation,
> of course.
> Suggestion?

You can use classes in your map file's layer declaration, where values
within a certain range are given a color range, as in below:
==================================
...
CLASS
  NAME "[-200..-175]"
  EXPRESSION ([pixel] >-255 AND [pixel] <=-175)
  KEYIMAGE "class2.gif"
  STYLE
      COLORRANGE 128 0 0 192 64 0
      DATARANGE -255 -175
      OUTLINECOLOR 0 0 0
    END
  END

  CLASS
  NAME "[-175..-100]"
  EXPRESSION ([pixel] >=-175 AND [pixel] <=-100)
  KEYIMAGE "class3.gif"
  STYLE
      COLORRANGE 192 64 0 255 150 0
      DATARANGE -175 -100
      OUTLINECOLOR 0 0 0
    END
  END
...
===========================

In the example above, values start from -200, but you can adapt it to
your case for values b/n 0 and 3008. class2.gif, class3.gif, etc are
small images created by hand to show up in the legend with the color
gradient.

Using COLORRANGE will cut down significantly on the number of CLASS
objects declared for your LAYER.

Does this help? I hope I understand your problem correctly...

Alex


More information about the mapserver-users mailing list