[OpenLayers-Users] Deleting a Vector Layer - How?

Bilge Tutak bilge.tutak at gmail.com
Tue Aug 12 16:17:51 EDT 2008


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 <bthoen at gisnet.com> 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 at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list