The route whose properties.progress will be used for interpolation.
The progress array must cover the requested index (i.e. the first entry's
pointIndex must be ≤ pathIndex and the last's must be ≥ pathIndex).
Zero-based index into the route's coordinate array.
Interpolated RouteProgressAtPoint, or undefined when:
progress datapathIndex is outside [0, coordinates.length - 1]pathIndex falls outside the range covered by the progress entriesconst progress = route.properties.progress;
// progress = [
// { pointIndex: 0, distanceInMeters: 0, travelTimeInSeconds: 0 },
// { pointIndex: 50, distanceInMeters: 2500, travelTimeInSeconds: 120 },
// { pointIndex: 100,distanceInMeters: 5000, travelTimeInSeconds: 300 }
// ]
const result = calculateProgressAtRoutePoint(route, 25);
// result = { distanceInMeters: 1250, travelTimeInSeconds: 60 }
Interpolates the cumulative traveled distance and time at an arbitrary point on the route path.
Uses the route's
progressarray to linearly interpolate between the two bracketing RouteProgressPoint entries that surround the requestedpathIndex.