3

I've been working on an ionic app that lets user find the distance between two places and shows the recommended route.

This app also updates the lat and long of the user in the database every 2 seconds.

Now I need to implement the actual distance and route that the user will travel between point A and B, but I am confused as in how exactly will I achieve this?

Should I store the lat and long in an array every 2 seconds and then just plot them on the map. I learned about the google roads api but it only accepts upto 100 lat and long values. Also how should I calculate the distance if the driver doesn't follow the recommended route?

I am confused about the implementation as I need to save the state so I was thinking of saving the coordinates in database. But it seems like I will have to save thousands of coordinates for every trip. Any solutions for this problem?

  • Possible duplicate of [Calculate distance between two points in google maps V3](http://stackoverflow.com/questions/1502590/calculate-distance-between-two-points-in-google-maps-v3) – Mimouni Oct 19 '15 at 14:07
  • 1
    Yeah but I don't need the distance between two points. I need the actual distance through which the user travels and user can choose any route or change his path anytime or the second point may not be defined. –  Oct 19 '15 at 14:09

0 Answers0