Routes Preferred API 目前仅适用于部分客户。如需了解详情,请
与销售人员联系。
路线两轮车
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Routes Preferred API 支持四种出行方式:
双轮机动车是指双轮机动车辆(例如摩托车)。
双轮机动车出行方式与自行车出行方式不同,后者是一种人力驱动的出行方式。
指定双轮机动车出行方式
调用 Routes Preferred API 时,您可以使用 RouteTravelMode
枚举值来指定出行方式。
示例
以下示例演示了如何在 ComputeRoutes()
方法请求正文中设置出行模式。
{
"origin":{
"location":{
"latLng":{
"latitude":37.419734,
"longitude":-122.0827784
}
}
},
"destination":{
"location":{
"latLng":{
"latitude":37.417670,
"longitude":-122.079595
}
}
},
"travelMode":"TWO_WHEELER"
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-22。
[null,null,["最后更新时间 (UTC):2025-07-22。"],[[["\u003cp\u003eRoutes Preferred APIs support four travel modes: drive, walk, bicycle, and two-wheeler (motorcycles).\u003c/p\u003e\n"],["\u003cp\u003eTwo-wheeler travel mode is distinct from bicycle travel mode, catering to motorized two-wheeled vehicles instead of human-powered ones.\u003c/p\u003e\n"],["\u003cp\u003eWhen using Routes Preferred APIs, specify the desired travel mode using the \u003ccode\u003eRouteTravelMode\u003c/code\u003e enumeration value within the request.\u003c/p\u003e\n"],["\u003cp\u003eAn example demonstrates how to set the \u003ccode\u003etravelMode\u003c/code\u003e to "TWO_WHEELER" within the \u003ccode\u003eComputeRoutes()\u003c/code\u003e method request body, illustrating its practical application.\u003c/p\u003e\n"]]],["The Routes Preferred APIs support four travel modes: Drive, Walk, Bicycle, and Two-wheeler, where Two-wheeler refers to motorized two-wheeled vehicles. To use a specific mode, utilize the `RouteTravelMode` enumeration in the API call. For example, to specify the two-wheeler mode in the `ComputeRoutes()` method request body, set the `\"travelMode\"` parameter to `\"TWO_WHEELER\"`. The two-wheeler mode is distinct from the bicycle mode, which is human-powered.\n"],null,["# Route Two-wheeled Vehicles\n\nRoutes Preferred APIs support four travel modes:\n\n- Drive\n- Walk\n- Bicycle\n- Two-wheeler\n\nTwo-wheeler refers to two-wheeled motorized vehicles (for example, motorcycles).\nThe two-wheeler travel mode differs from the bicycle travel mode, which is a\nhuman-powered travel mode.\n\nSpecifying the two-wheeler travel mode\n--------------------------------------\n\nWhen you call the Routes Preferred APIs, you use a\n[`RouteTravelMode`](https://developers.google.com/maps/documentation/routes_preferred/reference/rest/Shared.Types/RouteTravelMode)\nenumeration value to specify the travel mode.\n\n### Example\n\nThe following example demonstrates how to set the travel mode in the `ComputeRoutes()` method request\nbody. \n\n```cplint\n{\n \"origin\":{\n \"location\":{\n \"latLng\":{\n \"latitude\":37.419734,\n \"longitude\":-122.0827784\n }\n }\n },\n \"destination\":{\n \"location\":{\n \"latLng\":{\n \"latitude\":37.417670,\n \"longitude\":-122.079595\n }\n }\n },\n \"travelMode\":\"TWO_WHEELER\"\n}\n```"]]