I am trying to give a polyline a new set of co ordinates from a server. When trying to use the .setLatLngs method to redraw the new line with updated co ordinates i get the error "Uncaught TypeError: a.setLatLngs is not a function". Am I using this method incorrectly? If so how do i use this method?
var a = new L.LatLng(0,0),
b = new L.LatLng(0,0);
var polyline = new L.Polyline([a, b]).addTo(mymap);
//this is inside an ajax query
a.setLatLngs([latA1,lonA1]);
b.setLatLngs([latA6,lonA6]);
//latA1, lonA1 are new points for a point on the line
//latA6, lonA6 are new points for a point on the line