TomTom Maps for JavaScript
    Preparing search index...

    Type Alias LegSummary

    LegSummary: SummaryWithConsumption & {
        chargingInformationAtEndOfLeg?: ChargingStop;
        stopTimeInSeconds?: number;
    }

    Summary information for a single route leg.

    A leg is the portion of the route between two consecutive waypoints.

    Type Declaration

    • OptionalchargingInformationAtEndOfLeg?: ChargingStop

      Charging information at the end of this leg.

      Present only if this leg ends at a charging stop, indicating the vehicle will charge at this waypoint before continuing to the next leg.

      Contains details about:

      • Charging park location and facilities
      • Required charging time
      • Target charge level after charging
      chargingInformationAtEndOfLeg: {
      chargingParkId: 'park-123',
      chargingTimeInSeconds: 1200, // 20 minutes
      targetChargeInkWh: 80,
      targetChargeInPCT: 80
      }
    • OptionalstopTimeInSeconds?: number

      Time in seconds the vehicle stands still at the stop this leg arrives at.

      One number for the whole stop, whatever it is spent on — a WaypointProps.pauseDurationSeconds the caller asked for, charging the routing service planned on an EV route, or both at one stop. It is what the service actually planned rather than an echo of the request: the gap between this leg's arrivalTime and the next leg's departureTime.

      For the breakdown, LegSummary.chargingInformationAtEndOfLeg carries the charging part; whatever is left is waiting.

      • Absent when the vehicle does not stop at the end of this leg
      • Absent on the last leg, which has no following departure — and the routing service does not accept a wait at the destination anyway
      • This leg's own travelTimeInSeconds is driving only and excludes the stop, while the route's total includes every stop. So driving time is the sum of the legs, and the time spent standing still is the difference.
      // Half an hour at this stop, twenty minutes of it charging
      stopTimeInSeconds: 1800
      chargingInformationAtEndOfLeg: { properties: { chargingTimeInSeconds: 1200 } }
    • An A→B route has 1 leg
    • An A→B→C route has 2 legs (A→B, B→C)
    • An EV route can hold more legs than the stops asked for, one per charging stop the service adds