Issue
I want to calculate the duration between two points. I know there is Google Maps API but I don't want to use it, I need an equation to do it. There is one calculate the distance I need one for the duration of drive time.
Solution
Well, take a guess how you can achieve that without the knowledge of
- roads
- speed limit
- traffic
- graphs
Pretty hard. I see 2 solutions:
Use the Google Distance Matrix API
https://developers.google.com/maps/documentation/distance-matrix/start
Estimate with Speed
Location loc1 = new Location("");
loc1.setLatitude(lat1);
loc1.setLongitude(lon1);
Location loc2 = new Location("");
loc2.setLatitude(lat2);
loc2.setLongitude(lon2);
float distance = loc1.distanceTo(loc2);
int speed=30;
float time = distance/speed;
Answered By - Philipp
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.