You are right and I think it's how openlayers works. You can only do a getInfo on visible layers. The problem is when 2 or more are visible, which one the user want to query ?
I got another answer by mail: A simple way is to build a dropdown list with the layer names to set the active layer. http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/labels.html function populateLayer(aktLyr) { //populate select for layers var theHTML = '<select id="selAktLyr" onchange="setAktLyr();">'; for(var i=4;i<map.layers.length;i++) //exclude Google layers 0-3 { theHTML += '<option value=' + i + '>' + map.layers[i].name; } document.getElementById("spanselAktLyr").innerHTML = theHTML + '</select>'; if(!aktLyr) map.aktLayer = 4; else { map.aktLayer = aktLyr; } document.getElementById("selAktLyr").value=map.aktLayer; } function setAktLyr() { map.aktLayer = document.getElementById("selAktLyr").value; } BY:Arnd Wippermann This is what I want to do. I will try this, but I would like to know if openlayers has this functionnality built-in. I will come back to confirm the Arnd's solution is working. -- View this message in context: http://www.nabble.com/How-to-select-a-particular-layer-tp19034039p19035432.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
