I do not know why this does not work. I would suggest that the answer is really simple. I need to remove a layer before adding a new one.
if (graphic) { window.map.removeLayer(graphic); } var graphic = new OpenLayers.Layer.Image( 'Sightline'+''+SC, url, new OpenLayers.Bounds(derWesten[0].firstChild.nodeValue,derSueden[0].firstChild.nodeValue,derOsten[0].firstChild.nodeValue, derNorden[0].firstChild.nodeValue), new OpenLayers.Size(0,0), options ); window.map.addLayer(graphic);
It just keeps overlays on layers and doesn't remove them. Any help?
source share