<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 <michsred@gmail.com><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> url: '<a href="http://webgis.24gis.pl/geoserver/wms%27" target="_blank">http://webgis.24gis.pl/geoserver/wms'</a>, <br> title: 'Identify features by clicking',<br> queryVisible: true,<br> infoFormat: 'text/html',<br> maxFeatures: 1,<br> eventListeners: {<br>
getfeatureinfo: function(event) {<br> popup = new OpenLayers.Popup.FramedCloud(<br> "chicken", <br> map.getLonLatFromPixel(event.xy),<br> null,<br> event.text,<br> null,<br> true<br> ), {<br>
autoSize: false,<br> maxSize: new OpenLayers.Size(5,5)<br> };<br> map.addPopup(popup);<br> }<br> }<br> });<br> 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>