Hector
Hector

Reputation: 5428

derive any points latitude and longitude between a pair of Latitudes and Longitudes

I have a pair of Latitude & Longitude coordinates, lat1, long1, lat2 & long2. I need to be able to calculate any points location (lat3, long3) between lat1, long1 and lat2 & long2. I found this answer that gives the mid point between a pair of points.

However i need a more flexible solution, e.g. I would like to be able to specify 1/3, 1/4, 8/9 etc between the pair of points.

NOTE: lat1, long1 & lat2 & long2 are less than 0.2 miles apart.

Upvotes: 3

Views: 94

Answers (1)

Andreas
Andreas

Reputation: 159215

With linear interpolation, you simply apply the fraction (1/2, 1/3, 1/4, 8/9) to the difference between the Latitudes and to the difference between the Longitudes, and add that to the first Latitude/Longitude.

If f is the fraction:

latF = lat1 + f * (lat2 - lat1)
longF = long1 + f * (long2 - long1)

Upvotes: 0

Related Questions