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

Håvard Wahl Kongsgård haavard.kongsgaard at gmail.com
Tue Dec 6 09:12:12 EST 2011


Thanks, worked like a charm :-)

-Håvard

2011/12/6 Raymond Nijssen <r.nijssen at terglobo.nl>:
> 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
>>
>
>



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


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


More information about the Users mailing list