I need a function in C# to do the following: move 50 meters from gps-point A in the direction of gps-point B and calculate the GPS-coordinates for that point.
For instance I’ve got two coordinates:
LatLon LatLonA = new LatLon(51.83966, 5.04631); // Latitude 51.83966, Longitude 5.04631
LatLon LatLonB = new LatLon(51.84172, 5.01961); // Latitude 51.84172, Longitude 5.01961
What I would like is a function like this:
function LatLon MoveTowards(LatLon A, LatLon B, double MetersOverGround)
{
//code here
}
That function would return the coordinate which is x meters away from A in the direction of B.
The Earth is not a sphere, nor even an ellipse. The best you can hope for without purchasing a commercial library would be an approximation (which for most people is good enough).
You could start by looking into the Haversine formula, and this page will be of great help.
Or if you want a commercial library, I have used ProLat with great success