[OpenLayers-Users] Clear Line

Kenny France kenny at xarex.com
Wed Sep 10 10:15:27 EDT 2008


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/4f240bd7/attachment.html


More information about the Users mailing list