Los datos faltantes agregados entre dos puntos JavaScript

var latA=32.718835,
    lonA=-16.761171,
    latB=32.711461,
    lonB=-16.911347,
    lat = Math.floor(latA * 1e6), // use integers
    lon = Math.floor(lonA * 1e6),
    countLat = Math.floor(Math.abs(latA-latB)*1e6)+1,
    countLon = Math.floor(Math.abs(lonA-lonB)*1e6)+1,
    count = Math.max(countLat, countLon), // change to Math.min to use least number of points
    lonDiff = (lonB-lonA) / countLat * 1e6,
    latDiff = (latB-latA) / countLon * 1e6,
    latSign = Math.sign(latB - latA),
    lonSign = Math.sign(lonB - lonA),
    arr = [];
    
if (countLat < countLon) { // change to > to use least number of points
    lonDiff = lonSign;
} else {
    latDiff = latSign;
}
    
for (let i = 0; i <= count; i++) {
    arr.push({
        lat: (lat / 1e6).toFixed(6),
        lon: (lon / 1e6).toFixed(6)
    });
    lat += latDiff;
    lon += lonDiff;
    
}
console.log(arr.length, arr[0], arr.slice(-1)[0]);
Horrible Hummingbird