ThinkGeo.com    |     Documentation    |     Premium Support

WMSOverlay IsVisible Property Doesn't seem to Work

Hi,


I'm using a WMSOverlay object but I want to be able to turn it off and on with a check box.  I have the WMSOverlay showing fine but when I go to turn it off by setting the IsVisible property equal to false it still displays.  Is this a bug?  I was able to recreate it in the LoadAWMSlayer.aspx sample app by adding the following line of code.



wms.IsVisible =



false;

In that sample the WMS layer still displays even though the IsVisible property is set to false.  Let me know if I'm doing something wrong.


Thanks!




Clint,


This is a bug; we will solve it in the next release. Now to work around, we need to add the javascript function as following. Here attached is the sample code, any more queries please let us know


 


 



  <script type="text/javascript">
        var OnMapCreating = function(map){
            Class.Extent(WmsOverlay.prototype,{
                createWms:function(){
                                        this.element = new OpenLayers.Layer.WMS(this.name, this.url, this.params, this.options);
                                        this.element.id = this.id;
                                        this.element.visibility = this.options.visibility;
                                    }
            })
        }
        
    </script>


Ben.

135-823ForClint.zip (7 KB)