Enum Mode
模式
表示在查找路线时使用的出行方式的枚举。
如需调用枚举,您需要调用其父类、名称和属性。例如
Maps.Mode.DRIVING
。
属性
属性 | 类型 | 说明 |
DRIVING | Enum | 经由道路的驾车路线。 |
WALKING | Enum | 经由步道和人行道(如有)的步行路线。 |
BICYCLING | Enum | 经由自行车道和首选街道(如有)的骑车路线。 |
TRANSIT | Enum | 经由公共交通路线的公交路线(如果有)。此模式要求您设置
出发时间或到达时间
// Log all available data for a public-transit trip.
var directions = Maps.newDirectionFinder()
.setOrigin('The Cloisters, New York, NY')
.setDestination('JFK airport, New York, NY')
.setMode(Maps.DirectionFinder.Mode.TRANSIT)
.setDepart(new Date())
.getDirections();
var route = directions.routes[0];
Logger.log(route);
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-08-21。
[null,null,["最后更新时间 (UTC):2024-08-21。"],[[["`Maps.Mode` is an enum used to specify the mode of transportation for directions."],["The available modes are `DRIVING`, `WALKING`, `BICYCLING`, and `TRANSIT`."],["`TRANSIT` mode requires specifying either departure or arrival time."],["Each mode utilizes specific routes like roads, pedestrian paths, bicycle paths, or public transit routes as appropriate."]]],["The `Mode` enum defines travel methods for finding directions. It includes `DRIVING`, `WALKING`, and `BICYCLING`, for road, pedestrian, and cycling routes respectively. `TRANSIT` offers public transit routes, requiring departure or arrival time specification. To use, reference as `Maps.Mode.PROPERTY`. An example is provided for setting a public transit route, by using `.setMode(Maps.DirectionFinder.Mode.TRANSIT)` and calling the `getDirections()` function.\n"]]