AI-generated Key Takeaways
-
The
Mode
enum represents different modes of travel for finding directions. -
You access the
Mode
enum by calling its parent class, name, and property, such asMaps.Mode.DRIVING
. -
Properties of the
Mode
enum includeDRIVING
,WALKING
,BICYCLING
, andTRANSIT
. -
The
TRANSIT
mode requires setting either a departure or arrival time.
An enum representing the mode of travel to use when finding directions.
To call an enum, you call its parent class, name, and property. For example,
Maps.Mode.DRIVING
.
Properties
Property | Type | Description |
---|---|---|
DRIVING | Enum | Driving directions via roads. |
WALKING | Enum | Walking directions via pedestrian paths and sidewalks (where available). |
BICYCLING | Enum | Bicycling directions via bicycle paths and preferred streets (where available). |
TRANSIT | Enum | Transit directions via public transit routes (where available). This mode requires that you set
either the departure or arrival time.
// Log all available data for a public-transit trip. const directions = Maps.newDirectionFinder() .setOrigin('The Cloisters, New York, NY') .setDestination('JFK airport, New York, NY') .setMode(Maps.DirectionFinder.Mode.TRANSIT) .setDepart(new Date()) .getDirections(); const route = directions.routes[0]; Logger.log(route); |