Eric,
On 5 February 2011 22:50, Eric Lemoine <[email protected]> wrote:
> You must be cautious when iterating and removing elements. One
> technique involves iterating in the reverse order:
>
> for(var i=map.layers.length-1; i>=0; i--) {
> var l = map.layers[i];
> if(!l.isBaseLayer) {
> map.removeLayer(l);
> }
> }
Thank you, that works fine. Can you explain why it makes a difference to
iterate in this way?
Regards,
Tom
--
http://tom.acrewoods.net http://twitter.com/tom_chance
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users