[OpenLayers-Users] Destroying old popup before crating new one

Håvard Wahl Kongsgård haavard.kongsgaard at gmail.com
Tue Dec 6 08:55:11 EST 2011


Hi, with the OpenLayers.Control.WMSGetFeatureInfo function how do I
destroy old popups before creating a new one?

I have tried using map.removePopup(popupwindow) without success.


popup_size = new OpenLayers.Size(420,400);

info = new OpenLayers.Control.WMSGetFeatureInfo({            url:
'http://www.example.com:8080/geoserver/wms',             title:
'Identify features by clicking',            layers: [tiled],
 //hover:true,            queryVisible: true,
eventListeners: {                getfeatureinfo: function(event) {
                               popupwindow = new
OpenLayers.Popup.FramedCloud(                        "chicken",
                map.getLonLatFromPixel(event.xy),
  popup_size,                        event.text,
 null,                        true                    );

                  map.addPopup(popupwindow);
//alert(event.text);                                  }            }
       });

-- 
Håvard Wahl Kongsgård
NTNU-DMF/HUNT
http://havard.security-review.net/


More information about the Users mailing list