Question

How to calculate the time taken to travel between two points in the map view.

Was it helpful?

Solution

Measured Travel Time

You can only do that if you have the timestamp stored together with the coordinates of the points. Other solutions are unrealistic. If you have both timestamps, then it is simple to calculate the difference in number of seconds.

Convert both times to "timeSinceReferenceDate" and subtrac:

something like deltaSeconds = abs(t2 - t1);

Estimated Traveltime automotive

If you have only coordinates, and want to know the estimated travel time by using a car, you have to use a routing service, which calculates the route and time duration for your you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top