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?