Having Trouble Clearing (deleting) Dynamically Created Polyline Before Displaying Another
I am having trouble clearing any existing polylines before displaying a new one. I've already tried more than 5 different methods (array length = 0, MVCArray clear, polylines.setMa
Solution 1:
hope this help
//global path
var path = null;
...
//create new polyline
var polyLine = new google.maps.Polyline({
path: polylinesArray,
strokeColor: routeInfoJSON.color,
strokeOpacity: 0.8,
strokeWeight: 5
});
//delete old
var prepath = path;
if(prepath){
prepath.setMap(null);
}
//new polyline
polyLine.setMap(this.map);
// assign toglobal var path
path = polyLine;
Post a Comment for "Having Trouble Clearing (deleting) Dynamically Created Polyline Before Displaying Another"