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

Raymond Nijssen r.nijssen at terglobo.nl
Tue Dec 6 09:08:37 EST 2011


Havard,

I'm using this to destroy any existing popups:

while (map.popups.length > 0) {
    map.removePopup(map.popups[0]);
}

Regards,
Raymond

> 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/
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list