Q:

Calculating coordinates between 2 points using distance travelled from first point

I am trying to get geo-location coordinates of current location between points a and b, knowing only distance travelled from point a, assuming user has gone in a straight line
var disatnce_travelled = 375; //miles
function initialize() {
var locations = new Array(new google.maps.LatLng(40.7142700, -74.0059700),new google.maps.LatLng(43.585278, 39.720278));
var bounds = new google.maps.LatLngBounds();
for(i in locations)
    bounds.extend(locations[i]);
var mapOptions = {
 zoom: 3,
 center: bounds.getCenter(),
 mapTypeId: google.maps.MapTypeId.TERRAIN
};

var map = new google.maps.Map(document.getElementById('map-canvas'),
   mapOptions);

var flightPlanCoordinates = locations;
var flightPath = new google.maps.Polyline({
 path: flightPlanCoordinates,
 strokeColor: '#7f3f98',
 strokeOpacity: 1.0,
 strokeWeight: 2
});

flightPath.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

A:

The google.maps.geomettry library has an interpolate method. Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng.
However that seems to interpolate along a geodesic path. example
One option would be to use the v3 port of Mike Williams' epoly library
<script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=geometry"></script>
<script src="scripts/v3_epoly.js"></script>
<script>
var distance_travelled = 375; //miles
function initialize() {
var locations = new Array(new google.maps.LatLng(40.7142700, -74.0059700),new google.maps.LatLng(43.585278, 39.720278));
var bounds = new google.maps.LatLngBounds();
for(i in locations)
    bounds.extend(locations[i]);
var mapOptions = {
 zoom: 2,
 center: bounds.getCenter(),
 mapTypeId: google.maps.MapTypeId.TERRAIN
};

var map = new google.maps.Map(document.getElementById('map-canvas'),
   mapOptions);

var flightPlanCoordinates = locations;
var flightPath = new google.maps.Polyline({
 path: flightPlanCoordinates,
 strokeColor: '#7f3f98',
 strokeOpacity: 1.0,
 strokeWeight: 2
});

flightPath.setMap(map);
var marker = new google.maps.Marker({
   position: flightPath.GetPointAtDistance(distance_travelled*1609.34),
   map:map});
}

google.maps.event.addDomListener(window, 'load', initialize);

working example

