[Mapserver-users] softening raster layers through SLD

Jan Hartmann j.l.h.hartmann at uva.nl
Thu Apr 29 04:16:26 PDT 2004


Bart van den Eijnden wrote:

 >
 > can SLD (maybe through the GammaValue of the ContrastEnhancement) be
 > used in Mapserver to soften down a raster layer (e.g. a topographical
 > map in GeoTiff format) on the fly by a user with a certain percentage?
 > Or maybe this is possible another way?
 >
 > So nothing should be changed to the classification, only the raster
 > layer should be softened down by a certain percentage.
 >



Hi Bart,

I have been using browser based transparency to overlay map layers. 
Essentially, you call MapServer twice, once for the transparent layer, 
and once for the rest. Both images are overlaid in the browser. You 
define them as follows:

<img style="position:absolute">
<img style="position:absolute;filter:alpha(opacity=100)">

<script>
var img1 = document.getElementsByTagName("img")[0]
var img2 = document.getElementsByTagName("img")[1]

//to make img2 50% transparent in IE:
img2.filters.alpha.opacity = 50
// to make img2 50% transparent under Mozilla:
img2.style.mozOpacity = 0.5

// to put maps in both images:

img1.src=http://<mapserv url to base image>&mode=map
img2.src=http://<mapserv url to overlay image>&mode=map

You need two calls to MapServer for this, but they can be directed to 
two different servers. In my experience this only slightly slower than 
computing one map with internal overlay, if only because everything can 
be done in eight bits.


HTH,

Jan



More information about the MapServer-users mailing list