RoutingSummary
The duration and distance from the routing origin to a place in the response, and a second leg from that place to the destination, if requested. Note: Adding routingSummaries
in the field mask without also including either the routingParameters.origin
parameter or the searchAlongRouteParameters.polyline.encodedPolyline
parameter in the request causes an error.
JSON representation |
{
"legs": [
{
object (Leg )
}
],
"directionsUri": string
} |
Fields |
legs[] |
object (Leg )
The legs of the trip. When you calculate travel duration and distance from a set origin, legs contains a single leg containing the duration and distance from the origin to the destination. When you do a search along route, legs contains two legs: one from the origin to place, and one from the place to the destination.
|
directionsUri |
string
A link to show directions on Google Maps using the waypoints from the given routing summary. The route generated by this link is not guaranteed to be the same as the route used to generate the routing summary. The link uses information provided in the request, from fields including routingParameters and searchAlongRouteParameters when applicable, to generate the directions link.
|
Leg
A leg is a single portion of a journey from one location to another.
JSON representation |
{
"duration": string,
"distanceMeters": integer
} |
Fields |
duration |
string (Duration format)
The time it takes to complete this leg of the trip. A duration in seconds with up to nine fractional digits, ending with 's '. Example: "3.5s" .
|
distanceMeters |
integer
The distance of this leg of the trip.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-02-27 UTC.
[null,null,["Last updated 2025-02-27 UTC."],[[["Routing Summary provides the duration and distance between an origin and a destination, or between an origin, a place, and a destination when searching along a route."],["It includes a directions URI for viewing the route on Google Maps."],["A Leg within the Routing Summary represents a portion of the journey, containing duration and distance in meters."],["When searching along a route, the `legs` field will contain two legs: one from the origin to the place and another from the place to the destination."]]],["The content details routing summary data, including journey legs and a directions link. A routing summary contains \"legs,\" with each leg representing a portion of a journey. Each `leg` provides `duration` (time to complete the leg) and `distanceMeters`. The `directionsUri` field provides a Google Maps link for directions. When searching along a route, the summary includes two legs, otherwise it only includes one. Including `routingSummaries` in a request requires including an `origin` or `encodedPolyline` parameter.\n"]]