Transparent raster layer (with Jpegs source rasters)

Frank Warmerdam warmerdam at POBOX.COM
Mon Oct 1 22:32:10 EDT 2007


On 10/1/07, Pedro Mendes <mendes at gaveta.net> wrote:
> Hi people,
>
> I´m trying to display a raster layer from a tileindex file (.shp). The
> source rasters for this shapefile are jpeg with the following info:
...
> My prob is that i can´t force mapserver only to render the black color in
> the rasters (i tried changing several parameters in the layer object, and
> using different output declarations). If it´s possible can u show it to me?
>
> The output format isn´t important, just wanna get fully transparent layers
> (in colors grey and white, keeping black).

Pedro,

My understanding is that you want black (0,0,0) in your
source raster to be rendered, and all other values to be
treated as transparent ... is that right?

The only mechanism that comes to mind to accomplish
this is to define a class for pixel value 0 with a color
of 0,0,0 and no other classes so all other values will
appear as transparent.  Something like:

  CLASS
    EXPRESSION ([pixel]  = 0)
    COLOR 0 0 0
  END

You may find that the source jpeg file has corrupted some
black pixels causing them to have values near zero but not
quite equal to zero.  to capture these too, you might change
your expression to be something like [pixel] < 5.

Good luck,
-- 
---------------------------------------+--------------------------------------
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