[OpenLayers-Users] Popups appear on every click?

maw269 maw269 at gmail.com
Wed Apr 6 15:41:05 EDT 2011


I have successfully added popups to my map, however I can't seem to keep the
popups from appearing on clicks that are not associated with the
WMSGetFeatureInfo layers property. If I click somewhere on the map that
doesn't have feature info, I just get a blank popup.

How can I have it so that popup only appear on the layers withing the
'layers' property?

Here is my code:


var info = new OpenLayers.Control.WMSGetFeatureInfo
({
     url: 'http://domain/geoserver/wms', 
     layers: [PostCodes],							
     queryVisible: true,						
     eventListeners: 
     {						
          getfeatureinfo: function(event) 
         {								
               map.addPopup(new OpenLayers.Popup.FramedCloud
               (
                    "chicken", 
                    map.getLonLatFromPixel(event.xy),
                    null,
                    event.text,
                    null,
                    true
               )
               );
        }
     }
});

map.addControl(info);
info.activate();


Any ideas?

Matt

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Popups-appear-on-every-click-tp6247348p6247348.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list