Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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);
map.layers.length;
map.layers.remove;

Can anyone help me ?

share|improve this question

1 Answer 1

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

For layer manipulation the Map class has getLayer, setLayer and removeLayer methods: http://dev.openlayers.org/releases/OpenLayers-2.11/doc/apidocs/files/OpenLayers/Map-js.html#OpenLayers.Map.getLayer

Try to use them instead.

share|improve this answer

Your Answer

 
discard

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.