Hi Eric

The code I am using (slightly simplified) is below. I am not calling
getZIndex, I have been assuming that it is called somehow as part of the
layer.destroy() function. The other relevant piece of information is that if
I repeat the layer.destroy() call I get the div is null error only on even
numbers: so first time is OK, 2nd time error, 3rd time OK again, 4th time
error....etc.

  

    cityWFS = new OpenLayers.Layer.Vector("Cities", {
            styleMap: cityStyle,
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.WFS.v1_1_0({
            url:
"http://localhost/cgi-bin/mapserv.exe?map=c:/ms4w/apps/NewStart/htdocs/citie
s.map",
            featureType: "Cities",
            info_format: 'text',
            hover: true,
            maxFeatures: 100,
            filter: cityFilter,
            featureNS: "http://mapserver.gis.umn.edu/mapserver";
              })  //protocol
            });
           
     if (cityHover==null){   
         
         var cityHover = new OpenLayers.Control.SelectFeature(cityWFS, {
         hover: true,
         highlightOnly: true,
               overFeature: function(feature) {
           
                        "some code"
               },            
               
                  outFeature: function(feature) {
              }
                "more code"
        }); 
     
            } 
      
       
         map.addControl(cityHover);
         cityHover.activate();
              
         map.addLayer(cityWFS);
  

 

-----Original Message-----
From: Eric Lemoine [mailto:[email protected]] 
Sent: 12 April 2010 09:38
To: [email protected]
Cc: [email protected]
Subject: Re: [OpenLayers-Users] vector layer destroyed twice throws error

On Mon, Apr 12, 2010 at 8:13 AM, Chris Green <[email protected]>
wrote:
> Hello List
>
>
>
> I am using OL 2.8 and have a vector layer that is populated with features
> via WFS. In my application I  need to be able to remove and re-create the
> vector layer repeatedly, which I can perform once only  but the second
time
> I call layer.detroy() I get the error ‘this div is null’ thrown by the
> getZIndex function in Layer.js.

The error indicates that getZIndex is called on a destroyed layer. Is
it your code that calls getZIndex?

Cheers,
-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : [email protected]
http://www.camptocamp.com


_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to