Hello all
I want this function to give me the path distance from the starting point to the ending point.
I also want to add points within the path as rest points and force the path to pass through them to calculate the actual distance.
Of course, these points in the function are preferred to be optional for the user.
ِAny help to do that, please
CODE "Apps Script":
function DrivingMeters(Start, Stoppoint1,Stoppoint2,End) {
var directions = Maps.newDirectionFinder()
.setOrigin(Start)
.addWaypoint(Stoppoint1)
.addWaypoint(Stoppoint2)
.setDestination(End)
.getDirections();
return directions.routes[0].legs[0].distance.value;
}
I want this function to give me the path distance from the starting point to the ending point.
I also want to add points within the path as rest points and force the path to pass through them to calculate the actual distance.
Of course, these points in the function are preferred to be optional for the user.
ِAny help to do that, please
CODE "Apps Script":
function DrivingMeters(Start, Stoppoint1,Stoppoint2,End) {
var directions = Maps.newDirectionFinder()
.setOrigin(Start)
.addWaypoint(Stoppoint1)
.addWaypoint(Stoppoint2)
.setDestination(End)
.getDirections();
return directions.routes[0].legs[0].distance.value;
}