[OpenLayers-Users] Destroying all the features in a vector layer
Eric Lemoine
eric.c2c at gmail.com
Tue Aug 5 07:30:03 EDT 2008
On Tue, Aug 5, 2008 at 11:49 AM, Simone Gadenz <simone.gadenz at jrc.it> wrote:
> Hello!
>
>
>
> I have a layer of vector geocoded features that I want to be clean when the
> users click on a button.
>
> The features react to the user interaction opening a popup managed by the
> SelectFeatures control.
>
>
>
> I manage to remove all the feature from the map using a very simple function
> like this:
>
>
>
> function clearData(layer){
>
> layer.destroyFeatures();
>
> }
>
>
>
> The problem is if one popup is open when the functio is called. In that case
> the popup is not destroyed.
>
>
>
> Is there a way of removing all the popups?
There's nothing in the API. But you can do it with this:
for (var i = map.popups.length - 1; i >= 0; --i) {
map.removePopup(map.popups[i]);
}
--
Eric
--
Eric
More information about the Users
mailing list