Calculate point between two coordinates based on a percentage
Assuming the coordinate is a decimal number. You can use this equation.
function midpoint(lat1, long1, lat2, long2, per) {
return [lat1 + (lat2 - lat1) * per, long1 + (long2 - long1) * per];
}
Return a new desired coordinate of [lat, long], based on the percentage (such as per=0.2 for 20%).
Here is a reference that will help a lot (check the bottom)
http://www.movable-type.co.uk/scripts/latlong.html
Intermediate point
An intermediate point at any fraction along the great circle path between two points can also be calculated.
Formula:
a = sin((1−f)⋅δ) / sin δ b = sin(f⋅δ) / sin δ x = a ⋅ cos φ1 ⋅ cos λ1 + b ⋅ cos φ2 ⋅ cos λ2 y = a ⋅ cos φ1 ⋅ sin λ1 + b ⋅ cos φ2 ⋅ sin λ2 z = a ⋅ sin φ1 + b ⋅ sin φ2 φi = atan2(z, √x² + y²) λi = atan2(y, x)
where f is fraction along great circle route (f=0 is point 1, f=1 is point 2), δ is the angular distance d/R between the two points.