<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Michal,</div><div><br></div><div>You may try checking if "event.text" has your data before adding a popup. There may be a better way.</div><div><br></div><div>-Ravi.<br></div><div><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> michsred &lt;michsred@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> users@openlayers.org<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, August 3, 2011 7:22 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [OpenLayers-Users] Popup only on WMS layer object<br></font><br>Hi list,<br><br>is it possible to construct GetFeatureInfo machanism with popup
 which will<br>be active only on objects (points, lines, polygons) from WMS layers. I<br>already have popups working on my whole map. When I click outside of object<br>e.g polygon the opened popup is empty. I would like to have popups which<br>apear only on objects (or more precisely, only on places where<br>GetFeatureInfo information is present).<br><br>This is GetFeatureInfo code which I use:<br><br>info = new OpenLayers.Control.WMSGetFeatureInfo({<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; url: '<a href="http://webgis.24gis.pl/geoserver/wms%27" target="_blank">http://webgis.24gis.pl/geoserver/wms'</a>, <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; title: 'Identify features by clicking',<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; queryVisible: true,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; infoFormat: 'text/html',<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; maxFeatures: 1,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; eventListeners: {<br>&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; getfeatureinfo: function(event) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; popup = new OpenLayers.Popup.FramedCloud(<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; "chicken", <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; map.getLonLatFromPixel(event.xy),<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; null,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; event.text,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; null,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; true<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ), {<br>&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; autoSize: false,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; maxSize: new OpenLayers.Size(5,5)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; map.addPopup(popup);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; });<br>&nbsp;&nbsp;&nbsp; map.addControl(info);<br><br><br>Thank you in advance for any sugestion!<br><br>Michal<br><br>--<br>View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/Popup-only-on-WMS-layer-object-tp6648352p6648352.html" target="_blank">http://osgeo-org.1803224.n2.nabble.com/Popup-only-on-WMS-layer-object-tp6648352p6648352.html</a><br>Sent from the OpenLayers Users mailing list archive at
 Nabble.com.<br>_______________________________________________<br>Users mailing list<br><a ymailto="mailto:Users@lists.osgeo.org" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br><br><br></div></div></div></body></html>