TomTom Maps for JavaScript
    Preparing search index...

    Function getRouteProgressForSection

    • Calculates progress measurements for a route section.

      Convenience wrapper around getRouteProgressBetween that accepts a SectionProps directly, using its startPointIndex and endPointIndex as the segment bounds.

      Parameters

      • route: Route

        The route whose properties.progress will be used for interpolation.

      • section: SectionProps

        The section whose start and end point indices define the segment.

      Returns RouteSegmentProgress | undefined

      A RouteSegmentProgress object, or undefined when either index cannot be interpolated (see calculateProgressAtRoutePoint for the full list of conditions).

      const section = route.properties.sections.countries[0];
      const result = getRouteProgressForSection(route, section);
      if (result) {
      console.log(`Section starts ${result.start.distanceInMeters} m from route origin`);
      console.log(`Section ends ${result.end.distanceInMeters} m from route origin`);
      console.log(`Section length ${result.delta.distanceInMeters} m`);
      console.log(`Section takes ${result.delta.travelTimeInSeconds} s`);
      }