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 working with OpenLayers, I created a new plugin to perform a selection feature. But every event I perform in my plugin button it creates a new layers. (Attached is a print).

Of the attempts that tried to make the removal of the layer were:

map.layers.remove (0);

Can anyone help me ?

share|improve this question

Don't work directly with properties that have get/set method.

For layer manipulation the Map class has getLayer, setLayer and removeLayer methods:

Try to use them instead.

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.