[Mapserver-users] Help COLOR_MATCH_THRESHOLD

Frank Warmerdam warmerdam at pobox.com
Tue Apr 22 09:55:55 EDT 2003


Hussain, Asghar (IWMIPK) wrote:
> Dear all
>  
> I am publishing raster data through mapserver. I wants to use GDAL 
> library how I can use in map file for example I have elevation data the 
> values are more than 256 color. So I wants to decrease the color depth. 
> please can any one help and share the map file code with me ?

Asghar,

I don't think you need to use COLOR_MATCH_THRESHOLD in this case.  Instead you
need to scale your elevation data into the range 0-255 (or perhaps a more
constrained range).

By default the GDAL raster input code for MapServer will just truncate pixel
values outside the range 0-255, so any elevation over 255 would be set to
255.

What you need to do is establish the range of values that can occur, and then
set a SCALING processing directive to control the scaling of the raw raster
values into the 0-255 range.

For instance if a utility like gdalinfo (or metadata) tells you that the
range of elevation is 0 to 1000 you might put the following directive in
the LAYER section to force the input range to be scaled down to 0-255:

  PROCESSING "SCALE=0,1000"

If you don't want to figure out the min and max for your dataset, and don't
need to be able to document exactly what output values correspond to in
input elevations you could just use auto-scaling.

  PROCESSING "SCALE=AUTO"

Note that auto-scaling is based only on the rectangle of raster data loaded
for a particular request, so the scaling applied will vary depending on the
section of data being viewed.  This is often inappropriate.  Auto-scaling will
always be inappopriate if you want to produce a legend with meaningful range
values for the classes.

I think that the SCALE processing option is documented in the mapfile
reference.

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