Hi, you should use:
var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", {layers: 'railway_30m', format: 'image/png', transparent: true}, {isBaseLayer: false, visibility: true, transitionEffect: 'resize'}); Please not the 3rd parameter is the layer parameters, which are sent to the server. The 4rd parameter is the layer options. Best regards, Bart > > Hello, > > If there is something I am doing incorrectly in trying to access the > railway_30m layer (below) transparently, please let me know. Otherwise, I > thought this was something I should draw someone's attention to. > > Although this item is somewhat related to > http://n2.nabble.com/WMS-transparent-TRUE-versus-true-td1823416.html#a1823416 > and http://trac.openlayers.org/ticket/678 (which was, I believe, submitted > to address the problem reported in the first link), I don't believe those > items dealt with actually trying to set transparency on a WMS layer as > suggested. > > In OpenLayers 2.8, given the following example: > > var options = { > projection: "EPSG:4269", > maxExtent: new OpenLayers.Bounds(-135, 38, -50, 78), > }; > this.map = new OpenLayers.Map('map', options ); > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, visibility: true, transitionEffect: > 'resize'}); > this.map.addLayers([CTISwms]); > > var CTIS_wms_limits = new OpenLayers.Layer.WMS( "CTI-S WMS, limits", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'limits', format: 'image/png'}, > {isBaseLayer: true, visibility: true, transitionEffect: > 'resize'}); > this.map.addLayers([CTIS_wms_limits]); > > this.map.zoomToMaxExtent(); > > > I have been unable to set the railway_30m layer to be transparent using > any > of the following syntax: > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, transparent: true, visibility: true, > transitionEffect: 'resize'}); > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, transparent: "true", visibility: true, > transitionEffect: 'resize'}); > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, visibility: true, transitionEffect: 'resize', > params: {TRANSPARENT: true}}); > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, visibility: true, transitionEffect: 'resize', > params: {TRANSPARENT: "true"}}); > > > None of the above will actually send the TRANSPARENT parameter in the > request to the WMS service. The only way I was able to get the request to > be > sent with that parameter and to get the layer to display transparently was > as follows: > > var CTISwms = new OpenLayers.Layer.WMS( "CTI-S WMS", > "http://wms.sst-sw.rncan.gc.ca/wms/toporama_en?transparent=true", > {layers: 'railway_30m', format: 'image/png'}, > {isBaseLayer: false, visibility: true, transitionEffect: > 'resize'}); > > > Also, I noticed while investigating this that both WMS.js and > ArcGIS93Rest.js assume that params.TRANSPARENT is a string and do not > handle > boolean anymore as suggested by the fix noted above. > > -- > View this message in context: > http://n2.nabble.com/transparent-param-not-sent-to-WMS-service-tp3615475p3615475.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users