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

Ivan Grcic ivan.grcic at geo-solutions.it
Mon Apr 11 04:23:02 EDT 2011


Hola Antoni,

if available, always use setters/getters for attributes.

So using layer.setVisibility(true/false) should raise event and
layerswitcher should change accordingly.

Regards,
Ivan

On Mon, Apr 11, 2011 at 10:15 AM, Vidal, Antoni <antoni.vidal at icc.cat> wrote:
> 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
> 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
>
>



-- 
-------------------------------------------------------
Ivan Grcic
GeoSolutions S.A.S.
Software Engineer


Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:   +39 328 0559267


http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://twitter.com/geosolutions_it
http://www.youtube.com/user/GeoSolutionsIT


-------------------------------------------------------


More information about the Users mailing list