1

I want to calculate the time require to complete path in between two location as like in Maps application in which if you will find the path in two location then it will also show you the estimated time required to complete it.

Please suggest me regarding it.

Thanks in advance.

Shashank
  • 877
  • 7
  • 15

1 Answers1

2

If you use the Google Directions API you will be provided with a duration for the trip as part of the returned route. All you have to do is specify whether it should calculate for walking, bicycling or driving.

Claus Broch
  • 9,212
  • 2
  • 29
  • 38
  • Thanks Claus, But i am having one doubt if we will get more than one item in Legs array then which Duration we have to consider? as like in below json file "http://maps.googleapis.com/maps/api/directions/json?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&sensor=false" Please suggest me regarding it. – Shashank May 24 '11 at 09:25
  • You would have to add the durations from each leg. The durations for each leg will already have added up the durations for each of the steps of that leg. In your example it would add up to something close to 34 hours. – Claus Broch May 24 '11 at 09:34