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'm doing the following in my code and am wondering if it's too much or is there any benefit?



share|improve this question
up vote 5 down vote accepted

Copy and paste from the OpenLayers mailing list:

Hi Ian. removeFeatures removes the feature from the layer (and from the feature array) but the features aren't destroyed, for example they can later be added back to the layer. After removeFeatures the layer has no references on the layers, user code is therefore responsible for destroying the features and releasing references so that the features are garbage-collected. After destroyFeatures the features are removed from the layer and destroyed. Like after removeFeatures they shouldn't reappear on the layer after redraw, if you observe otherwise it's certainly a bug that we need to track down. Cheers. Eric

share|improve this answer
So i guess all i really want is destroy... thanks! – CaptDragon Jun 23 '11 at 15:02

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.