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

Xurxo Mendez sonxurxo at gmail.com
Mon Apr 11 04:23:05 EDT 2011


Hi,

you can use setVisibility(visibility) method of Layer class, instead of
setting 'visibility' property directly.

Best regards,

Xurxo Méndez Pérez

http://blog.sonxurxo.com
http://www.sonxurxo.com



2011/4/11 Vidal, Antoni <antoni.vidal at icc.cat>

> 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
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110411/90fc88c9/attachment.html


More information about the Users mailing list