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 代码。如需了解详情,请参阅 https://plus.codes。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):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. |"]]