[mapserver-users] Classify raster image
Andrea Goethals
andreag at geoplan.ufl.edu
Thu Jun 21 09:31:51 PDT 2001
This works for version 3.3.011:
LAYER
NAME forden
TYPE raster
DESCRIPTION "Forest Density"
STATUS default
MAXSCALE 4300000
DATA grids/forden.tif
CLASSITEM 'dummy'
CLASS
NAME "91-100 percent forest cover"
EXPRESSION ([value] > 90 AND [value] < 101)
COLOR 50 70 43
END
CLASS
NAME "81-90 percent forest cover"
EXPRESSION ([value] > 80 AND [value] < 91)
COLOR 63 88 54
END
CLASS
NAME "71-80 percent forest cover"
EXPRESSION ([value] > 70 AND [value] < 81)
COLOR 76 106 65
END
CLASS
NAME "61-70 percent forest cover"
EXPRESSION ([value] > 60 AND [value] < 71)
COLOR 89 124 76
END
CLASS
NAME "51-60 percent forest cover"
EXPRESSION ([value] > 50 AND [value] < 61)
COLOR 102 142 87
END
CLASS
NAME "41-50 percent forest cover"
EXPRESSION ([value] > 40 AND [value] < 51)
COLOR 115 160 98
END
CLASS
NAME "31-40 percent forest cover"
EXPRESSION ([value] > 30 AND [value] < 41)
COLOR 128 178 109
END
CLASS
NAME "21-30 percent forest cover"
EXPRESSION ([value] > 20 AND [value] < 31)
COLOR 141 196 120
END
CLASS
NAME "1-10 percent forest cover"
EXPRESSION ([value] > 0 AND [value] < 11)
COLOR 182 255 156
END
END
Andrea
>
> Berend Veldkamp wrote:
> >
> > Hi,
> > How do I classify a raster image, like:
> > 0-10 -> red
> > 10-20 -> orange
> > 20-30 -> yellow
> >
> > I know I can reclassify the tiff images, but can this also be done
> > on-the-fly.
>
> I think you can use the special attribute name "VALUE" to represent the
> pixel values in your class expressions... so the following should
> hopefully work:
>
> CLASSITEM "VALUE"
> CLASS
> EXPRESSION ([VALUE] < 10)
> COLOR 255 0 0
> END
> CLASS
> EXPRESSION ([VALUE] < 20)
> COLOR ...
> END
> CLASS
> EXPRESSION ([VALUE] < 30)
> COLOR ...
> END
>
> --
> ------------------------------------------------------------
> Daniel Morissette morissette at dmsolutions.ca
> DM Solutions Group http://www.dmsolutions.ca/
> ------------------------------------------------------------
> Don't put for tomorrow what you can do today, because if
> you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list