3
votes

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.

1
Maybe combine that solution with linear interpolation? - Torsten Römer
With less than .2 miles you can assume the world is flat. I would go with torsten's suggestion - Romain Hippeau
I think Torsten is correct, however whats the formula to interpolate? - Hector

1 Answers

0
votes

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)