[OpenLayers-Users] layer.visibility = true doesn't add checkbox

Vidal, Antoni antoni.vidal at icc.cat
Mon Apr 11 04:15:32 EDT 2011


Hello list,

 

I would like to show an overlay, only when baselayer is aerial photo, not over baselayer topographic map. 

 

My code:

 

map.events.register("changebaselayer", map, function(){

                var tpnorto = map.getLayersByName("topoorto")[0];

                if(map.baseLayer.name == 'Topographic'){

                               tpnorto.visibility = "false";

                }else tpnorto.visibility = "true";

});

 

I get visibility change ok, but checkbox next to overlay name (in layerswitcher) are not showned and I wold like to check and uncheck this layer to allow user to try if overlay is visible or not when they select aerial map.

 

Any suggestion?

 

Thank's in advance.

 

Antoni Vidal

Unitat d'Aplicacions SIG-WEB
Institut Cartogràfic de Catalunya <http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?CONSULTA=Institut%20Cartogr%25E0fic%20de%20Catalunya&XYADDRESS=429486:4580392> 
Parc de Montjuïc, E-08038 Barcelona
Tel. (+34) 93 567 15 00 (ext. 3228)
www.icc.cat <http://www.icc.cat/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110411/39cc4367/attachment.html


More information about the Users mailing list