[OpenLayers-Users] Removing a layer

Carlos Pinto cmsp76 at gmail.com
Tue Oct 14 10:57:37 EDT 2008


Hi all,
I am having one trouble and I don't know what else to do.

I have my map and I have develop some javascript code that is working fine.
What happened this weekend is that I developed a function that had that some
layers in the beginning:


var myStyle128684655922811250 = new OpenLayers.StyleMap({fillOpacity:
0.5});var rules128684655922811250 = {0: {fillColor: '#ffffff',
fillOpacity:0.5}   };

myStyle128684655922811250.addUniqueValueRules('default', 'type',
rules128684655922811250);

var layer128684655922811250 = new OpenLayers.Layer.GML('mercury layer',
'../GML/glmush55qv3web45ak21mhrf128684655922811250.xml',{styleMap:
myStyle128684655922811250} );

map.addLayer(layer128684655922811250);


and this is working fine.  What is really funny is that the following code
only works if the code above is outside a function. If the code above is
inside the init() function then this code don't work:

//// REMOVE THE LAYER
map.removeLayer(layer128684657963905000);
layer128684657963905000.destroy();


Why??? Anybody knows why??????

Thanks

Best,

Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081014/6c630024/attachment.html


More information about the Users mailing list