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-02-27。
[null,null,["最后更新时间 (UTC):2025-02-27。"],[[["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"]]