Bilge, removeLayer won't destroy the layer. However the opposite is
true: layer.destroy() does remove the layer from the map. So, in fact,
layer.destroy() should suffice. Eric

2008/8/12, Bilge Tutak <[EMAIL PROTECTED]>:
> Looks like you are trying to access a non-existing layer (the one you
> recently removed) with the 3rd and 4th line.
>     myLayer.vector.destroyFeatures();
>     myLayer.vector.destroy();
> My guess it first destroy everything and then remove the layer.
>
> On Tue, Aug 12, 2008 at 4:10 PM, Bill Thoen <[EMAIL PROTECTED]> wrote:
>> I need to get rid of a vector layer and all of its contents, but I'm not
>> sure of the syntax. When I try:
>>
>>  if (myLayer != null) {
>>    map.removeLayer( myLayer );
>>    myLayer.vector.destroyFeatures();
>>    myLayer.vector.destroy();
>> }
>>
>> it seems to die on  'myLayer.vector.destroyFeatures();' How should I do
>> this?
>>
>> - Bill Thoen
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users@openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
> _______________________________________________
> Users mailing list
> Users@openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to