This is the documentation of version 1.0.0-rc.0. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Function getRouteProgressForSection

    • Calculates progress measurements for a route section.

      It wraps getRouteProgressBetween to take a SectionProps directly, using its startPointIndex and endPointIndex as the segment bounds.

      Parameters

      • route: Route

        The route whose properties.progress is interpolated.

      • section: SectionProps

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

      Returns RouteSegmentProgress | undefined

      A RouteSegmentProgress, or undefined if either index can't be interpolated. calculateProgressAtRoutePoint lists all the conditions.

      const section = route.properties.sections.country[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`);
      }