Optional
alternatives?: booleanOptional
arrival_Specifies the desired time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC.
You can specify either departure_time
or arrival_time
, but not both.
Note that arrival_time
must be specified as an integer.
Optional
avoid?: TravelRestriction[]Indicates that the calculated route(s) should avoid the indicated features.
Optional
departure_Specifies the desired time of departure. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC.
Alternatively, you can specify a value of now
, which sets the departure time to the current time (correct to the nearest second).
The departure time may be specified in two cases:
departure_time
or arrival_time
.
If neither time is specified, the departure_time
defaults to now (that is, the departure time defaults to the current time).departure_time
to receive a route and trip duration
(response field: duration_in_traffic
) that take traffic conditions into account.
This option is only available if the request contains a valid API key, or a valid Google Maps APIs Premium Plan client ID
and signature. The departure_time
must be set to the current time or some time in the future. It cannot be in the past.The address, textual latitude/longitude value, or place ID to which you wish to calculate directions.
The options for the destination
parameter are the same as for the origin
parameter, described above
Optional
language?: LanguageThe language in which to return results.
language
is not supplied, the API attempts to use the preferred language as specified in the Accept-Language
header,
or the native language of the domain from which the request is sent.Optional
mode?: TravelModeSpecifies the mode of transport to use when calculating directions
Optional
optimize?: booleanWherever to optimize the provided route by rearranging the waypoints in a more efficient order.
The address, textual latitude/longitude value, or place ID from which you wish to calculate directions.
If you pass an address, the Directions service geocodes the string and converts it to a latitude/longitude coordinate to calculate directions. This coordinate may be different from that returned by the Geocoding API, for example a building entrance rather than its center.
origin=24+Sussex+Drive+Ottawa+ON
If you pass coordinates, they are used unchanged to calculate directions. Ensure that no space exists between the latitude and longitude values.
origin=41.43206,-81.38992
Place IDs must be prefixed with place_id:
. The place ID may only be specified if the request includes an API key or a
Google Maps APIs Premium Plan client ID. You can retrieve place IDs from the Geocoding API and the Places SDK
(including Place Autocomplete). For an example using place IDs from Place Autocomplete, see Place Autocomplete and
Directions.
origin=place_id:ChIJ3S-JXmauEmsRUcIaWtf4MzE
Optional
region?: stringSpecifies the region code, specified as a ccTLD ("top-level domain") two-character value.
Optional
traffic_Specifies the assumptions to use when calculating time in traffic.
This setting affects the value returned in the duration_in_traffic
field in the response, which contains the predicted time
in traffic based on historical averages. The traffic_model
parameter may only be specified for driving directions
where the request includes a departure_time
, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID.
The default value of best_guess
will give the most useful predictions for the vast majority of use cases.
It is possible the best_guess
travel time prediction may be shorter than optimistic
, or alternatively,
longer than pessimistic
, due to the way the best_guess
prediction model integrates live traffic information.
Optional
transit_Specifies one or more preferred modes of transit. This parameter may only be specified for transit directions, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID.
Optional
transit_Specifies preferences for transit routes. Using this parameter, you can bias the options returned, rather than accepting the default best route chosen by the API. This parameter may only be specified for transit directions, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID.
Optional
units?: UnitSystemSpecifies the unit system to use when displaying results.
Optional
waypoints?: LatLng[]Specifies an array of waypoints.
Waypoints alter a route by routing it through the specified location(s).
A waypoint is specified as a latitude/longitude coordinate, an encoded polyline, a place ID, or an address which will be geocoded.
Encoded polylines must be prefixed with enc:
and followed by a colon (:
). Place IDs must be prefixed with place_id:
.
The place ID may only be specified if the request includes an API key or a Google Maps APIs Premium Plan client ID.
Waypoints are only supported for driving, walking and bicycling directions.
If set to
true
, specifies that the Directions service may provide more than one route alternative in the response. Note that providing route alternatives may increase the response time from the server.