Can I get distance between 3 points using Google Directions API? -
i trying distance between more 2 points. code running fine , can between 2 points want more 2 points. like:
point 1 -> point 2 -> point 3 -> point 4
if can me good, in advance.
assuming know how find distance between 2 points... might want this:
function distanceof(points){ if (points.length<2){ return 0; } if (points.length==2){ //calculate distance between point x point x+1 return math.sqrt(math.pow(points[0].x-points[1].x, 2)+math.pow(points[0].y-points[1].y, 2)) } total=0; (i=0; < points.length-1; i++){ total+=distanceof([points[i],points[i+1]]); } return total; }
Comments
Post a Comment