3

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.

Community
  • 1
  • 1
Hector
  • 4,016
  • 21
  • 112
  • 211

1 Answers1

0

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)
Andreas
  • 154,647
  • 11
  • 152
  • 247