设置沿途停留点
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如需沿路线设置经停点(例如上车点或下车点),您可以将某个航点指定为经停点航点。为此,请使用航点的 vehicleStopover
属性,即 Waypoint (REST) 或 Waypoint (gRPC)。此设置可确保计算出的路线不会从不适合上车和下车的道路(例如高速公路或隧道)开始或结束。
假设地面道路与隧道内的道路相交。如果您指定位于这两条道路相交处的航点(如地图上所示),则生成的路线将从地面道路或隧道开始或结束。这会导致问题,因为您无法在隧道中停车上下客。
如果您想将路点用于上车点或下车点,请将 vehicleStopover
字段设置为 true
,以确保生成的路线始于或终于允许上车点或下车点的道路。
以下示例演示了如何设置 vehicleStopover
属性:
{
"origin":{
"location":{
"latLng":{
"latitude": 37.419734,
"longitude": -122.0827784
}
},
"vehicleStopover": true
},
...
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-06-20。
[null,null,["最后更新时间 (UTC):2025-06-20。"],[[["\u003cp\u003eUse the \u003ccode\u003evehicleStopover\u003c/code\u003e property to designate a waypoint as a stopover for pickups or drop-offs, ensuring the route avoids unsuitable roads like highways or tunnels.\u003c/p\u003e\n"],["\u003cp\u003eRequests utilizing the \u003ccode\u003evehicleStopover\u003c/code\u003e property incur higher billing rates compared to standard route requests.\u003c/p\u003e\n"],["\u003cp\u003eSetting \u003ccode\u003evehicleStopover\u003c/code\u003e to \u003ccode\u003etrue\u003c/code\u003e guarantees the route starts or ends on a road suitable for pickups and drop-offs, avoiding issues with waypoints located near tunnels or highways.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003evehicleStopover\u003c/code\u003e property is crucial for optimizing routes for vehicles that require specific pickup and drop-off locations.\u003c/p\u003e\n"]]],["To designate a waypoint for pickup or drop-off, set the `vehicleStopover` property to `true` within the Waypoint object. This ensures the route begins or ends on a suitable road, avoiding locations like highways or tunnels. Setting `vehicleStopover` prevents routes from starting/ending on unsuitable roads. The `vehicleStopover` property is set within the Waypoint's JSON structure. Using `vehicleStopover` incurs a higher billing rate.\n"],null,["# Set a stop along a route\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nTo set a stop along a route, for example, for a pickup or dropoff, you designate\na waypoint as a stopover waypoint. To do this, use the `vehicleStopover`\nproperty of a waypoint,\n[Waypoint](/maps/documentation/routes/reference/rest/v2/Waypoint) (REST) or\n[Waypoint](/maps/documentation/routes/reference/rpc/google.maps.routing.v2#waypoint) (gRPC).\nThis setting ensures that the calculated route doesn't begin or end on a road\nthat is unsuitable for pickup and drop-off, such as a highway or tunnel.\n| **Caution:** Requests using `vehicleStopover` are billed at a higher rate. [Learn more about billing](/maps/documentation/routes/usage-and-billing) for Routes API.\n\nConsider the situation where a surface road crosses over a road inside a tunnel.\nIf you were to specify a waypoint located where the two roads intersect (as seen\non a map), then the resulting route would begin or end on either the surface\nroad or the tunnel. This result presents a problem because you can't stop in\ntunnels to make pickups or drop-offs.\n\nIf you want to use the waypoint for a pickup or drop-off, then you set the\n`vehicleStopover` field to `true` to ensure that the resulting route begins or\nends on a road that allows pickups and drop-offs.\n\nThe following example demonstrates how to set the\n[`vehicleStopover`](/maps/documentation/routes/reference/rest/v2/TopLevel/computeRoutes#Waypoint.FIELDS.vehicle_stopover)\nproperty: \n\n```text\n{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\": 37.419734,\n \"longitude\": -122.0827784\n }\n },\n \"vehicleStopover\": true\n },\n ...\n}\n```"]]