[OpenLayers-Users] VectorLayer destroyFeatures doesn't work properly?

Eric Lemoine eric.lemoine at camptocamp.com
Sun Apr 11 10:15:44 EDT 2010


On Tuesday, April 6, 2010, gtg287y <gtg287y at gmail.com> wrote:
>
> I have a vectorLayer, polygonLayer, which I am calling
> destroyFeatures(polygonLayer.features) on. I can confirm that after calling
> it, the features go away in the polygonLayer.features variable. However, the
> features (polygons drawn by the DrawFeatures controller as per the example
> found at:
> http://openlayers.org/dev/examples/regular-polygons.html
> http://openlayers.org/dev/examples/regular-polygons.html
> ) don't actually go away on screen (they are still drawn on the map).

Hi. I'm not sure about what's going on here, but I suspect this is
related to both addFeatures and destroyFeatures fiddling with the
features array. As a workaround you can try to register to
beforefeaturesadded (instead of beforefeatureadded) and call
destroyFeatures with no argument. Hope this helps,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list