Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a map (using OpenLayers) and a vector layer containing features(points). Sometimes I need to remove all features from the vector layer. When I use


then it removes all features from only one zoom level. When I change zoom level, I see all my features again. How can I remove all features from all zoom levels?

share|improve this question

How were the features loaded in the layer in the first place?

Unless the features were added on the client (i.e. in a Javascript function written by you), when the extent changes the default behavior for Vector layers backed by WFS is to fetch new features from the server.

You can customize the behavior of the Vector layer with regard to remote sources by providing a properly configured strategy. Examples like this one are available in the examples page.

share|improve this answer
Yes, added in the client by js function. What strategy in this case should I use? – Bob Dec 9 '12 at 21:27
It looks llike you are using BBOX strategy. In your case you should use Fixed strategy. – drnextgis Dec 10 '12 at 1:06
Or deactivate your strategy, when you need to use BBOX. – user1702401 Dec 10 '12 at 6:40
@Bob can you include the code in your question? It's next to impossible w/o it. – unicoletti Dec 10 '12 at 7:33

Well I had the same problem too and solved it using the function destroyFeatures


but then the features have to be recreated.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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