@Eric Lemoine <br><br>Eric, just go the examples page <a href="http://www.openlayers.org/dev/examples/">http://www.openlayers.org/dev/examples/</a> <br>and type "feature info in popup". It's the first one that appears.<br>
<br>@Ziegler Stefan<br><br>Thanks for your suggestion.<br><br>I ended up solving it in a similar way.<br><br>Here's my previous code:<br><br>var info = new OpenLayers.Control.WMSGetFeatureInfo({<br> url: "<a href="http://127.0.0.1:8081/cgi-bin/mapserv.exe?map=c">http://127.0.0.1:8081/cgi-bin/mapserv.exe?map=c</a>:\\maps\\wms_postgis.map",<br>
title: 'Identify features by clicking',<br> queryVisible: true,<br> vendorParams: {<br> "FEATURE_COUNT": "1000"},<br> eventListeners: {<br>
getfeatureinfo:<br> 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();<br><br>and here's how I solved it:<br><br>var info = new OpenLayers.Control.WMSGetFeatureInfo({<br> url: "<a href="http://127.0.0.1:8081/cgi-bin/mapserv.exe?map=c">http://127.0.0.1:8081/cgi-bin/mapserv.exe?map=c</a>:\\maps\\wms_postgis.map",<br>
title: 'Identify features by clicking',<br> queryVisible: true,<br> vendorParams: {<br> "FEATURE_COUNT": "1000"},<br> eventListeners: {<br>
getfeatureinfo:<br> function(event) {<br> if((event.text).length != 1) {<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>Just an "if" solved. <br>Simpler than I expected :-P<br><br>thank you two!!<br>
<br>Marcos<br><br><br><div class="gmail_quote">On Wed, Aug 26, 2009 at 3:14 AM, Ziegler Stefan <span dir="ltr"><<a href="mailto:Stefan.Ziegler@bd.so.ch">Stefan.Ziegler@bd.so.ch</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;">
Hi Marcos<br>
<br>
my - not very sophisticated - approach:<br>
<br>
function setHTML(response) {<br>
if (response.responseText.indexOf('<body> </body>') == -1) {<br>
// show popup....<br>
}<br>
else {<br>
// do not show popup...<br>
}<br>
}<br>
It simply checks wether the returned html stuff consists only of two body tags. Probably you have to change the check string according to your wms server's empty response.<br>
<br>
regards<br>
Stefan<br>
<br>
<br>
<br>
<br>
<br>
----- Originalnachricht -----<br>
Von: Marcos Nogueira <<a href="mailto:nomarcos@gmail.com">nomarcos@gmail.com</a>><br>
Gesendet: Die, 25.8.2009 21:17<br>
An: <a href="mailto:users@openlayers.org">users@openlayers.org</a><br>
Betreff: [OpenLayers-Users] Popups doubt in example "Feature Info in Popup"<br>
<div class="im"><br>
Hi,<br>
<br>
I managed to use GetFeatureInfo perfectly in my application after checking the example "Feature Info in Popup".<br>
<br>
Every point that I click that has some information to be returned gets it returned. It's great.<br>
<br>
<br>
But the problem is, when I click in a place in the map that has no information, I mean, a point from my WMS layer that has no<br>
information about it in my source, it returns an empty popup.<br>
That behaviour also happens in the example. If you click in the white area, for example, it returns you an empty popup.<br>
<br>
<br>
The question I have is:<br>
how do I make for the popup to appear only when there's some information being returned ??<br>
<br>
I'm using openlayers 2.8<br>
<br>
</div><div class="im">Thanks for the attention guys<br>
<br>
Marcos<br>
<br>
<br>
<br>
<br>
<br>
--<br>
"Saber o que é certo e não fazê-lo é a pior covardia."<br>
<br>
<br>
</div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>"Saber o que é certo e não fazê-lo é a pior covardia."<br><br>