Background:
I\'m working with transport routes and Google provides Route points far apart enough to create \'shapes\'. These are the bus/train route
Comprehensive answer can be found here: http://www.movable-type.co.uk/scripts/latlong.html
TL;DR:
This uses the ‘haversine’ formula to calculate the great-circle distance between two points – that is, the shortest distance over the earth’s surface – giving an ‘as-the-crow-flies’ distance between the points (ignoring any hills, of course!).
var R = 6371; // km
var dLat = (lat2-lat1).toRad();
var dLon = (lon2-lon1).toRad();
var lat1 = lat1.toRad();
var lat2 = lat2.toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var distance = R * c;
Now you have the distance for this straight line, you can then work out a percentage of the overall distance for each 5 meters.
Find out the difference between the starting latitude and the final latitude. With this number, multiply it by the percentage traveled (as a decimal). This can then be added back to the starting latitude to find the current latitude of this point. Repeat for longitude.