Waypoint
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
封裝路線控點。路線控點會標記路線的起點和終點,並在路線沿途包含中繼停靠站。
JSON 表示法 |
{
"via": boolean,
"vehicleStopover": boolean,
"sideOfRoad": boolean,
// Union field location_type can be only one of the following:
"location": {
object (Location )
},
"placeId": string,
"address": string
// End of list of possible types for union field location_type .
} |
欄位 |
via |
boolean
將這個路線控點標示為里程碑,而不是停靠點。對於要求中的每個非透過路線控點,回應會在 legs 陣列中附加一個項目,提供行程中該路段的停靠站詳細資料。如果您想讓路線經過這個路線點而不停靠,請將這個值設為 true。透過路線控點,系統不會將項目加入 legs 陣列,但會讓路線經過路線控點。您只能在為中繼的路線控點設定此值。如果您在終端路線控點設定這個欄位,要求就會失敗。如果將 ComputeRoutesRequest.optimize_waypoint_order 設為 true,則這個欄位無法設為 true;否則要求失敗。
|
vehicleStopover |
boolean
表示路線控點是供車輛停靠,主要目的是讓使用者在上車或下車。設定這個值後,如果不適合上車和下車的道路,計算的路線就不會包含非 via 路線控點。這個選項僅適用於 DRIVE 和 TWO_WHEELER 交通方式,以及 locationType 為 Location 的情況。
|
sideOfRoad |
boolean
表示這個路線控點的位置是用來指定車輛在特定側面停靠的位置。設定這個值後,路線就會通過位置,這樣車輛就能在道路側停靠,該位置是從道路中心偏離位置。這個選項僅適用於 DRIVE 和 TWO_WHEELER RouteTravelMode 。
|
聯集欄位 location_type 。以不同方式表示地點。location_type 只能是下列其中一項: |
location |
object (Location )
使用地理座標指定的點,包含選擇性的方向。
|
placeId |
string
與路線控點相關聯的搜尋點地點 ID。
|
address |
string
人類可讀的地址或 Plus Code。詳情請參閱 https://plus.codes。
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eWaypoints define the start, end, and intermediate points of a route.\u003c/p\u003e\n"],["\u003cp\u003eWaypoints can be specified using geographic coordinates, Place IDs, or addresses.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003evia\u003c/code\u003e field allows a waypoint to be a pass-through point without stopping.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003evehicleStopover\u003c/code\u003e is used for pickup/drop-off optimization, while \u003ccode\u003esideOfRoad\u003c/code\u003e indicates preferred stopping side.\u003c/p\u003e\n"]]],["Waypoints, marking route start, end, and intermediate stops, are defined using a JSON format. Key properties include `via` (boolean) for non-stopping waypoints, `vehicleStopover` (boolean) for pickup/drop-off locations, and `sideOfRoad` (boolean) for preferred stopping side. A waypoint's `location_type` can be specified via geographic coordinates (`location`), a place ID (`placeId`), or a human-readable address (`address`). `via` cannot be true for terminal waypoints or if `optimize_waypoint_order` is true.\n"],null,["# Waypoint\n\n- [JSON representation](#SCHEMA_REPRESENTATION)\n\nEncapsulates a waypoint. Waypoints mark both the beginning and end of a route, and include intermediate stops along the route.\n\n| JSON representation |\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"via\": boolean, \"vehicleStopover\": boolean, \"sideOfRoad\": boolean, // Union field `location_type` can be only one of the following: \"location\": { object (/maps/documentation/routes/reference/rest/v2/Location) }, \"placeId\": string, \"address\": string // End of list of possible types for union field `location_type`. } ``` |\n\n| Fields ||\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `via` | `boolean` Marks this waypoint as a milestone rather a stopping point. For each non-via waypoint in the request, the response appends an entry to the [`legs`](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#Route.FIELDS.legs) array to provide the details for stopovers on that leg of the trip. Set this value to true when you want the route to pass through this waypoint without stopping over. Via waypoints don't cause an entry to be added to the `legs` array, but they do route the journey through the waypoint. You can only set this value on waypoints that are intermediates. The request fails if you set this field on terminal waypoints. If `ComputeRoutesRequest.optimize_waypoint_order` is set to true then this field cannot be set to true; otherwise, the request fails. |\n| `vehicleStopover` | `boolean` Indicates that the waypoint is meant for vehicles to stop at, where the intention is to either pickup or drop-off. When you set this value, the calculated route won't include non-`via` waypoints on roads that are unsuitable for pickup and drop-off. This option works only for `DRIVE` and `TWO_WHEELER` travel modes, and when the `locationType` is [`Location`](/maps/documentation/routes/reference/rest/v2/Location). |\n| `sideOfRoad` | `boolean` Indicates that the location of this waypoint is meant to have a preference for the vehicle to stop at a particular side of road. When you set this value, the route will pass through the location so that the vehicle can stop at the side of road that the location is biased towards from the center of the road. This option works only for `DRIVE` and `TWO_WHEELER` [`RouteTravelMode`](/maps/documentation/routes/reference/rest/v2/RouteTravelMode). |\n| Union field `location_type`. Different ways to represent a location. `location_type` can be only one of the following: ||\n| `location` | `object (`[Location](/maps/documentation/routes/reference/rest/v2/Location)`)` A point specified using geographic coordinates, including an optional heading. |\n| `placeId` | `string` The POI Place ID associated with the waypoint. |\n| `address` | `string` Human readable address or a plus code. See \u003chttps://plus.codes\u003e for details. |"]]