[OpenLayers-Users] Clear Line

Kenny France kenny at xarex.com
Wed Sep 10 11:44:25 EDT 2008


Fixed :)
 
if (lineFeature){
      lineFeature.layer.renderer.clear();
               lineFeature.layer.destroyFeatures();
 
    }
    
was the solution
 
Kenny

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Kenny France
Sent: 10 September 2008 16:15
To: Users at openlayers.org
Subject: [OpenLayers-Users] Clear Line


Hi All,
 
I have a app where i load markers with polylines from a xml file
 
when i click a link i load a new xml with the following function
 
  function loadXml(url){
       //Clear markers
       markers.clearMarkers();
    //Clear PolyPoints
    pointList = [];
    
             OpenLayers.loadURL(url, null, null, loadSuccess, loadFailure);
    
          //add the marker layer
          map.addLayer(polys);
          map.addLayer(markers);
    
    }
 
the problem i am having is it is clearing the old markers from the map but
it is not clearing the polyline
 
here is the code for the poly
var polys = new OpenLayers.Layer.Vector("polys");
 
if (addpoly == 1){
            newPoint = new OpenLayers.Geometry.Point(lng,lat);
                  pointList.push(newPoint);
      var lineFeature = new OpenLayers.Feature.Vector(
                     new
OpenLayers.Geometry.LineString(pointList),null,poly_style);
                     polys.addFeatures([lineFeature]);
      
              } //end Polys
 
is there a way i can somehow destroy / remove the old line?
 
Thanks
 
Kenny
 
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080910/2bd75d97/attachment.html


More information about the Users mailing list