color palette on a Arc Info Binary Grid (ADF)

Shantha, Raghavendra Vasanth raghu at KU.EDU
Thu Apr 7 10:02:02 EDT 2005


Thanks Matt..
This guided me in the right direction; I was able to apply a RGB color
palette.

Here is a mapscript version of adding palettes:


# minV, maxV - min, max raster value
# N - number of different color levels
# lyr - layer object
# clso - class object
# pal - palette
for i in range(0, N):
        clso.append(mapscript.classObj(lyr))
        clsExpr = "([pixel] >= " + str(minV)
        clsExpr += " and [pixel] <= " + str(minV+incr) + ")"
        clso[i].setExpression(clsExpr)
        styleo = mapscript.styleObj(clso[i])
        styleo.color.setRGB(p.pal[i][0], p.pal[i][1], p.pal[i][2])
        minV += incr



Thanks,
Raghu

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Matthew Perry
Sent: Wednesday, April 06, 2005 11:03 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] color palette on a Arc Info Binary
Grid (ADF)

Raghu,

  I've classified ArcInfo GRIDs using CLASS
expressions based on the pixel value. Here's a mapfile
sample:

LAYER
  NAME "wildlife_habitat"
  STATUS OFF
  TYPE RASTER
  # Folder containing the hdr.adf
  DATA "kb_veg_grid/kbshr_v10a/"
  CLASSITEM "[pixel]"
  CLASS
    NAME "Mixed Conifer"
    EXPRESSION ([pixel] < 48 OR [pixel] == 159)
    COLOR  0 123 27
  END
  CLASS
    NAME "Conifer/Hardwood"
    EXPRESSION ([pixel] >= 48 AND [pixel] < 81)
    COLOR 78 221 0
  END
  ....
  ....
END

Hope this helps. I did this manually which was
time-consuming given that I had 35+ classes.

There *might* be a way to convert your color table
(.clr) to classes or have gdal use the .clr
directly.... but I will defer to the rest of the list
on that one.

Good luck,

Matt Perry
Humboldt State University


--- "Shantha, Raghavendra Vasanth" <raghu at KU.EDU>
wrote:
> Hi,
>
> I was looking for a way to apply different color
> palettes (say shades of
> red, green etc) to a gray scale Arc Info Binary Grid
> (ADF) Raster file
> using mapserver.
>
> Any ideas as to how I can do this?
>
>
> Thanks,
> Raghu
>



More information about the mapserver-users mailing list