Given a starting point (origLat, origLon), ending point (destLat, destlon), and a % of trip completed. How do I calculate the current position (curLat, curLon)?
A:
In this case, it should be really simple:
curLat = origLat + percentageOfTripCompleted*(destLat-origLat);
curLon = origLon + percentageOfTripCompleted*(destLon-origLon);
*The fact that the earth is a sphere really has no bearing on this problem.
That is not a great circle path.
Lawnmower
2010-10-19 14:40:43
That is incorrect. Look at the link in @hfs's answer. Remember, great circle paths are *not* straight lines.
Jonathan
2010-10-19 14:43:58
thinking about this one a little more, that is definitely true. my bad.
2010-10-19 15:34:55
Technically speaking, if the distance is very short, this may be a valid approximation.
ysap
2010-10-19 17:22:16
@ysap Unless you're close to the central meridian, in which case this route might take you for a longer stroll :-)
Lawnmower
2010-10-20 09:54:47
+6
A:
Aviation Formulary is a great resource which covers this question and more.
hfs
2010-10-19 14:40:24
Just keep in mind that those formulas assume a spherical model. Formulas exist for ellipsoids (WGS84 and such) but they will be far more complicated. It all depends on your presicion requirements.
Lawnmower
2010-10-20 09:59:16
Works well. Though as Lawnmower says it is an estimate based on sphere. If anyone can provide a link to the same algorithm for a WGS84 model I would really appreciate it.
Anthony
2010-10-20 17:24:34
There are no longer simple formulas when moving to ellipsoids, but you have to use iterative approximations. Start at http://geographiclib.sourceforge.net/html/geodesic.html and see the references linked there. Maybe you can use the library directly or look at the code.
hfs
2010-10-20 20:04:09