Scale Buckets and Rasters
Frank Warmerdam
fwarmerdam at GMAIL.COM
Thu Jun 9 14:17:00 PDT 2005
On 6/2/05, Travis Kirstine GIS Tech <tkirstine at jdbarnes.com> wrote:
> Hi,
> I was hoping someone could give me some clarification on the PROCESSING
> SCALE and SCALE BUCKETS directives. I am displaying a classed 32bit
> floating raster using the following:
>
> CLASS
> NAME class1
> EXPRESSION ([pixel] = 0)
> COLOR 56 168 0
> END
> CLASS
> NAME class2
> EXPRESSION ([pixel] >= 0 and [pixel] <= 2)
> COLOR 90 186 0
> END
> CLASS
> NAME class3
> EXPRESSION ([pixel] > 2 and [pixel] <= 4)
> COLOR 131 207 0
> END
> CLASS
> NAME class4
> EXPRESSION ([pixel] > 4 and [pixel] <= 5)
> COLOR 176 224 0
> END
> CLASS
> NAME class5
> EXPRESSION ([pixel] > 5 and [pixel] <= 7)
> COLOR 228 245 0
> END
>
> etc for 10 classes.............
> This works but is fairly slow. So I am trying to use the processing buckets
> directive with the following syntax:
>
> PROCESSING "SCALE=0,444" #min and max values of raster
> PROCESSING "SCALE_BUCKETS=10" #number of classes
>
> When this is added mapserver only displays the higher values. Does the
> processing buckets directive only work on equal interval classes or do I
> just have a incorrect syntax.
> Travis
Travis,
If you use the above processing options, the range 0 to 444 will
be split into 10 *equal* buckets. So 0-44 wll be one bucket
for instance.
I would suggest:
> PROCESSING "SCALE=0,444" #min and max values of raster
> PROCESSING "SCALE_BUCKETS=444" #number of classes
This will ensure that only 444 buckets are created, but that they are
on integral boundaries which seems like it should be fine for your
purposes. Essentially it will classify each "middle of bucket" value
such as 0.5, 1.5, 2.5, and cache the result. Then values will
be assigned to one of these buckets.
Note that if your actual image data has alot of integral values, there
may be some uncertainty about which bucket they would fall into
since the integers will be the bucket boundaries. The edge conditions
may not be handled as they ought. If this is an issue you might want
to use slightly different range values.
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