I have an app that uses Google Maps and I want to get the travel time between my current location and another location. How will I do that? Thanks in advance.
Asked
Active
Viewed 4,671 times
1 Answers
3
You can use CLLocation to calculate the distance between two locations. Something like,
CLLocationDistance meters = [newLocation distanceFromLocation:oldLocation];
Once you calculated the distance, then you can easily calculate the travel time by using the speed distance time formula
i.e., speed = distance / time
since you know the distance and if you assume the speed, you can calculate time taken for the travel as
time = distance / speed
Checkout this link to use Google Maps API to calculate the time travel.
-
Is there something I can use in Google Maps API that will automatically calculate the travel time? – thedansaps Nov 25 '15 at 07:25
-
check out this [link](http://stackoverflow.com/questions/1042885/using-google-maps-api-to-get-travel-time-data) – PK20 Nov 25 '15 at 07:30