The route whose properties.progress is interpolated.
Zero-based index of the segment start in the route's coordinate array.
Zero-based index of the segment end in the route's coordinate array.
A RouteSegmentProgress, or undefined if either index can't be
interpolated. calculateProgressAtRoutePoint lists all the conditions.
const result = getRouteProgressBetween(route, 10, 60);
if (result) {
console.log(`Segment starts ${result.start.distanceInMeters} m from route origin`);
console.log(`Segment ends ${result.end.distanceInMeters} m from route origin`);
console.log(`Segment length ${result.delta.distanceInMeters} m`);
console.log(`Segment takes ${result.delta.travelTimeInSeconds} s`);
}
Calculates progress measurements for a segment between two arbitrary points on the route path.
It calls calculateProgressAtRoutePoint for both indices and returns the start and end measurements with the delta, the distance and time covered between them.