Add the Directions API to your application

Add the Directions API to your application

The directions API can be added to your application in the same way as the Distance Matrix API above and called in a similar manner:

https://maps.googleapis.com/maps/api/directions/json?units=imperial&origin=51.527699,0.132660&destination=51.494833,0.146312

You need to provide an origin and a destination point as well as a number of optional parameters which might include:

● waypoints — Specifies an array of waypoints. Waypoints alter a route by routing it through the specified location(s).
– This can be useful if you want to drop off or pick up at a number of locations.

● alternatives — If set to true, specifies that the Directions service may provide more than one route alternative in the response.
– This can be useful if you want to show a number of options for drop off to the user and allow them a choice (or to show that the usual quicker route is not necessarily the best one).

● language — Specifies the language in which to return results.
– This may be useful when you are providing details to people of different nationalities.

● departure_time — Specifies the desired time of departure.
– This can be useful if the user is booking in the future and wants to see the time it might take at that exact time.

● traffic_model (defaults to b est_guess) — Specifies the assumptions to use when calculating time in traffic.
– You can be either optimistic or pessimistic on the time returned when looking at future events, or show the range to the user which might be useful in planning.

Full information about everything that is returned is given at the following location:
https://developers.google.com/maps/documentation/directions/intro#Introduction

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *