RoutingSummary
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
从路线起点到响应中某个地点的用时和距离,以及从该地点到目的地的第二段路程(如果请求)。注意:如果在字段掩码中添加 routingSummaries
,但未在请求中添加 routingParameters.origin
参数或 searchAlongRouteParameters.polyline.encodedPolyline
参数,则会导致错误。
JSON 表示法 |
{
"legs": [
{
object (Leg )
}
],
"directionsUri": string
} |
字段 |
legs[] |
object (Leg )
行程的各个航段。 当您计算从设定的起点出发的行程时长和距离时,legs 包含一条包含从起点到目的地的行程时长和距离的行程。当您沿路线搜索时,legs 包含两段路程:一段是从起点到地点,另一段是从地点到目的地。
|
directionsUri |
string
用于使用给定路线摘要中的路点在 Google 地图上显示路线的链接。此链接生成的路线不一定与用于生成路线摘要的路线相同。该链接使用请求中提供的信息(包括 routingParameters 和 searchAlongRouteParameters 字段中的信息,如果适用)来生成路线链接。
|
腿
JSON 表示法 |
{
"duration": string,
"distanceMeters": integer
} |
字段 |
duration |
string (Duration format)
完成此行程所需的时间。 该时长以秒为单位,最多包含九个小数位,以“s ”结尾。示例:"3.5s" 。
|
distanceMeters |
integer
此行程的距离。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eRouting 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.\u003c/p\u003e\n"],["\u003cp\u003eIt includes a directions URI for viewing the route on Google Maps.\u003c/p\u003e\n"],["\u003cp\u003eA Leg within the Routing Summary represents a portion of the journey, containing duration and distance in meters.\u003c/p\u003e\n"],["\u003cp\u003eWhen searching along a route, the \u003ccode\u003elegs\u003c/code\u003e field will contain two legs: one from the origin to the place and another from the place to the destination.\u003c/p\u003e\n"]]],["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"],null,["# RoutingSummary\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n- [Leg](#Leg)\n - [JSON representation](#Leg.SCHEMA_REPRESENTATION)\n\nThe 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.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"legs\": [ { object (/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#Leg) } ], \"directionsUri\": string } ``` |\n\n| Fields ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `legs[]` | `object (`[Leg](/maps/documentation/places/web-service/reference/rest/v1/RoutingSummary#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. |\n| `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. |\n\nLeg\n---\n\nA leg is a single portion of a journey from one location to another.\n\n| JSON representation |\n|-----------------------------------------------------------|\n| ``` { \"duration\": string, \"distanceMeters\": integer } ``` |\n\n| Fields ||\n|------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `duration` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#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\"`. |\n| `distanceMeters` | `integer` The distance of this leg of the trip. |"]]