[mapserver-users] rgb expression with alpha?

Wendell Turner wendell at enflight.com
Thu Apr 1 16:10:11 PDT 2010


Hi,

I want to turn all non-transparent 'near white' pixels
transparent.  I've tried:

  LAYER
    NAME          "xx"
    TYPE           RASTER
    CONNECTIONTYPE ogr
    CONNECTION     "file.wld"
    DATA           "file.gif"

    # copied from here: http://mapserver.org/input/raster.html#raster
    # but I added the [alpha] and opacity part
    CLASS
      NAME "near white"
      EXPRESSION ( ([red] > 225) AND ([green] > 225) AND ([blue] > 225) AND ([alpha] > 225) )
      STYLE
        OPACITY 0
      END
    END
  END

(The file is an RGBA gif file.)

The [alpha] expression isn't recognized.  In fact, [foo] works just the same.

gdalinfo of the file shows:
  Color Table (RGB with 32 entries)
    0: 255,255,255,0
    1: 240,240,240,255
    ...

So it seems that the 0 entry defines the transparent color.

Q: is [alpha] a valid EXPRESSION item?  Is something else wrong?

Thanks,

Wendell

p.s., I'm always amazed at how capable and terrific mapserver is when
you dig enough into it.

p.p.s: MapServer version 5.4.1




More information about the MapServer-users mailing list