I used the example of this website : http://openlayers.org/en/v3.8.2/examples/feature-animation.html for make an animation.

I don't have problem for stopping the event with the function clearInterval(interval); if I declare before my interval var interval = window.setInterval(addRandomFeature,1000);

The problem is I want to clear the layer who contain the object (after my function clearInterval(interval);) and I don't understand what's the layer who contain the event and I don't know how can I clear this layer.

1 Answer 1


the only layer in the script has the name vector.

To clear the objects/featurees of this layer use:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.