RoutingSummary
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Thời lượng và khoảng cách từ điểm xuất phát của tuyến đường đến một địa điểm trong phản hồi, và chặng thứ hai từ địa điểm đó đến đích đến (nếu được yêu cầu). Lưu ý: Việc thêm routingSummaries
vào mặt nạ trường mà không thêm tham số routingParameters.origin
hoặc tham số searchAlongRouteParameters.polyline.encodedPolyline
vào yêu cầu sẽ gây ra lỗi.
Biểu diễn dưới dạng JSON |
{
"legs": [
{
object (Leg )
}
],
"directionsUri": string
} |
Trường |
legs[] |
object (Leg )
Các chặng của chuyến đi. Khi bạn tính thời gian và quãng đường di chuyển từ một điểm xuất phát đã đặt, legs sẽ chứa một chặng duy nhất chứa thời gian và quãng đường từ điểm xuất phát đến điểm đến. Khi bạn tìm kiếm dọc theo tuyến đường, legs sẽ chứa hai chặng: một chặng từ điểm xuất phát đến địa điểm và một chặng từ địa điểm đến điểm đến.
|
directionsUri |
string
Đường liên kết để hiển thị thông tin chỉ đường trên Google Maps bằng các điểm trung gian trong bản tóm tắt tuyến đường đã cho. Đường dẫn do đường liên kết này tạo ra không được đảm bảo giống với đường dẫn dùng để tạo bản tóm tắt định tuyến. Đường liên kết này sử dụng thông tin được cung cấp trong yêu cầu, từ các trường bao gồm routingParameters và searchAlongRouteParameters (nếu có) để tạo đường liên kết đến chỉ đường.
|
Chân
Chuyến bay là một phần của hành trình từ địa điểm này đến địa điểm khác.
Biểu diễn dưới dạng JSON |
{
"duration": string,
"distanceMeters": integer
} |
Trường |
duration |
string (Duration format)
Thời gian cần thiết để hoàn thành chặng này của chuyến đi. Thời lượng tính bằng giây, có tối đa 9 chữ số thập phân, kết thúc bằng "s ". Ví dụ: "3.5s" .
|
distanceMeters |
integer
Khoảng cách của chặng này trong chuyến đi.
|
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\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. |"]]