[mapserver-users] wms transparency

Jim White jbw2003 at earthlink.net
Mon Mar 7 16:59:55 EST 2011


I have a MapServer WMS server and I want to overlay its layers on a 
Google map WMS layer in OpenLayers.
I have tried to follow the example 
http://openlayers.org/dev/examples/layer-opacity.html , but am unable to 
get any transparency. All I get is a less bright layer.

var options2 = {
     maxExtent: new OpenLayers.Bounds(-7564972, 2022817, -7260079, 2099643),
     units: 'm',
     projection: "EPSG:3857",
     maxScale: 2000000
}
var map;
var wms;
var gphy;


$(document).ready(function() {
     map = new OpenLayers.Map('map', options2);
     wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
         "http://metacomet.zo.ncsu.edu/wms/prgap.php",
             {layers: 'pd009', format: "image/png", srs: "EPSG:3857"},
             { opacity: 0.3}
         );

     gphy = new OpenLayers.Layer.Google(
         "Google Physical",
         {type: google.maps.MapTypeId.TERRAIN, //sphericalMercator: true,
             'maxExtent': new OpenLayers.Bounds(-7564972, 2022817, 
-7260079, 2099643)
         });

     map.addLayer(wms);
     map.addLayer( gphy);
     map.zoomToMaxExtent();

Wil appreciate any suggestions for my MapServer config or OpenLayers script.

Jim


More information about the mapserver-users mailing list