A single leg of the journey from the origin to the destination in the calculated route. For routes that contain no waypoints, the route will consist of a single "leg," but for routes that define one or more waypoints, the route will consist of one or more legs, corresponding to the specific legs of the journey.

interface RouteLeg {
    arrival_time: Time;
    departure_time: Time;
    distance: Distance;
    duration: Duration;
    duration_in_traffic?: Duration;
    end_address: string;
    end_location: LatLngLiteral;
    start_address: string;
    start_location: LatLngLiteral;
    steps: DirectionsStep[];
}

Properties

arrival_time: Time

contains the estimated time of arrival for this leg. This property is only returned for transit directions.

departure_time: Time

contains the estimated time of departure for this leg, specified as a Time object. The departure_time is only available for transit directions.

distance: Distance

indicates the total distance covered by this leg, as a field with the following elements.

This field may be absent if the distance is unknown.

duration: Duration

indicates the total duration of this leg.

This field may be absent if the duration is unknown.

duration_in_traffic?: Duration

indicates the total duration of this leg. This value is an estimate of the time in traffic based on current and historical traffic conditions. See the traffic_model request parameter for the options you can use to request that the returned value is optimistic, pessimistic, or a best-guess estimate. The duration in traffic is returned only if all of the following are true:

  • The request includes a valid API key, or a valid Google Maps APIs Premium Plan client ID and signature.
  • The request does not include stopover waypoints. If the request includes waypoints, they must be prefixed with via: to avoid stopovers.
  • The request is specifically for driving directions—the mode parameter is set to driving.
  • The request includes a departure_time parameter.
  • Traffic conditions are available for the requested route.
end_address: string

contains the human-readable address (typically a street address) from reverse geocoding the end_location of this leg.

end_location: LatLngLiteral

contains the latitude/longitude coordinates of the given destination of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, end_location may be different than the provided destination of this leg if, for example, a road is not near the destination.

start_address: string

contains the human-readable address (typically a street address) resulting from reverse geocoding the start_location of this leg.

start_location: LatLngLiteral

contains the latitude/longitude coordinates of the origin of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, start_location may be different than the provided origin of this leg if, for example, a road is not near the origin.

contains an array of steps denoting information about each separate step of the leg of the journey.