Pablo:<br>Thanks for the help!!<br>I have a good idea as to how the popup works and that the feature info got the <br>layers that active and so far I have not found a way to display only the info for the topmost layer<br>I'll keep digging...<br>
<br>In the meantime... I have another question.....<br><br>When I click anywhere outside of the map I get a empty popup box/cloud <br>I add the following if statement but still get the empty popup...<br><br>getfeatureinfo: function(event) {<br>
if (event.text.indexOf() == -1)<br>
<br>
<br>Any suggestions as to how to prevent the pop in places that there should not be any<br><br>Thanks<br><br> map.addLayers([pwms,rwms,iwms]); <br><br> info = new OpenLayers.Control.WMSGetFeatureInfo({<br> url: '<a href="http://tobagoborn.com:8080/geoserver/wms">http://tobagoborn.com:8080/geoserver/wms</a>', <br>
title: 'Identify features by clicking',<br> queryVisible: true,<br> eventListeners: {<br> getfeatureinfo: function(event) {<br>if (event.text.indexOf() == -1) <-- ADDED THIS IF STATMENT<br>
{<br> map.addPopup(new OpenLayers.Popup.FramedCloud(<br> "chicken", <br> map.getLonLatFromPixel(event.xy),<br> null,<br> event.text,<br>
null,<br> true<br> ));<br>}<br> }<br> }<br> });<br> map.addControl(info);<br> info.activate();<br><br><br><br>
<br><div class="gmail_quote">On Fri, Feb 26, 2010 at 5:09 PM, Joe public <span dir="ltr"><<a href="mailto:joepub1962@gmail.com">joepub1962@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Pablo:<br>Before I got you reply which I'll try,,, I found and tried the following:<br><br>QUERY_LAYERS: map.layers[2].params.LAYERS,<br><br>But it didn't have the effect I wanted.....<br><br>What I really want is the pop up to show ONLY data for the active layer....<br>
Right now it is show data for the active layer plus the layer(s) underneath<br>Is this possible?<div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Fri, Feb 26, 2010 at 10:20 AM, pablo lopez <span dir="ltr"><<a href="mailto:plablo09@gmail.com" target="_blank">plablo09@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><div class="gmail_quote">Hi Joe, I think something like this shoul do it:<br><br> info = new OpenLayers.Control.<div>
WMSGetFeatureInfo({<br>
url: '<a href="http://tobagoborn.com:8080/geoserver/wms" target="_blank">http://tobagoborn.com:8080/geoserver/wms</a>',<br>
title: 'Identify features by clicking',<br> layers: [layer1, layer2,...], <---Here you provide an array of layer objects. These are the layers you are querying<br>
eventListeners: {<br>
getfeatureinfo: function(event) {<br>
map.addPopup(new OpenLayers.Popup.FramedCloud(<br>
"chicken",<br>
map.getLonLatFromPixel(event.xy),<br>
null,<br>
event.text,<br>
null,<br>
true<br>
));<br>
}<br>
}<br>
});<br>
map.addControl(info);<br>
info.activate();</div><br></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>