[OpenLayers-Users] loading layer group on check of Layerswitcher checkbox

sunny74 sb.ray at hotmail.com
Thu Sep 24 07:22:55 EDT 2009


Dear Friends,

I have a map of 12 layers.
I first load the base layer and then groups of layers each having 2 or 3.
My code is as shown below:

  map = new OpenLayers.Map('<%=map.ClientID%>');

  layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
                "http://172.16.128.173:8085/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', layers: 'STATE', 'format': 'png' });

         layer1 = new OpenLayers.Layer.WMS("BASIC",
                "http://172.16.128.173:8085/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', transparent: 'true', layers: 'basic', 'format': 'png'
});


    map.addLayers([layer, layer1]);
 Now layer is my base layer followed by layer group as shown above.
Now I would like layer1 and other such groups to be loaded on the checkbox
check event of 
the layerswitcher and also be visible at the same time.


This means that any one group is visible at a point in time.
How can I do it?
Presently all the groups are loading at PageLoad and they r overlapping each
other and nothing 
is visible.

If the above is not possible then I would like to put some condition like
scale before
loading a group,  for eg,

if(map.getScale() == 'something')
 {
    layer1 = new OpenLayers.Layer.WMS("BASIC",
                "http://172.16.128.173:8085/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', transparent: 'true', layers: 'basic', 'format': 'png'
});

  }

Pls suggest any other way in which I can manage the layer groups properly so
that they do 
not load at the same time?

Thanks.
-- 
View this message in context: http://n2.nabble.com/loading-layer-group-on-check-of-Layerswitcher-checkbox-tp3705538p3705538.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list