[OpenLayers-Users] transparent param not sent to WMS service

Eric Lemoine eric.lemoine at camptocamp.com
Thu Sep 10 00:15:11 EDT 2009


On Thursday, September 10, 2009, myOpenLayersUName
<joanne.mcgraw at sympatico.ca> wrote:
>
> Hello,

Hi


>
> If there is something I am doing incorrectly in trying to access the
> railway_30m layer (below) transparently,

move "transparent" in the first object passed to the constructor (the
3rd argument), alongside the "layers" property. "transparent" is an
HTTP parameter of the layer, not an option.




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 at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list