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);
|
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-21 (世界標準時間)。
[null,null,["上次更新時間: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"]]