#### ZenMusic

How do you Compute the Latitude and Longitude 1 nm ahead given the heading?

C# or c is my programming language. I can compute, distances and headings for position to position, but this must be some trig functions.

thanks, happy new year!

Here's an online caclulator.

You can use this to test your eventual calculations?

And the formula is here. You have to scroll down to the correct section, the top section is not what you want.

• Let first point latitude be la1,
• longitude as lo1,
• d be distance,
• R as radius of Earth,
• Ad be the angular distance i.e d/R and
• θ be the bearing,
Here is the formula to find the second point, when first point, bearing and distance is known:

• latitude of second point = la2 = asin(sin la1 * cos Ad + cos la1 * sin Ad * cos θ), and
• longitude of second point = lo2 = lo1 + atan2(sin θ * sin Ad * cos la1 , cos Ad – sin la1 * sin la2)

Hope this helps,

THANKS!

public (double newLatitude, double newLongitude) CalculateNewPosition(double latitude, double longitude, double heading, double distance)
{

double latRad = latitude * (Math.PI / 180);
double lonRad = longitude * (Math.PI / 180);

// Calculate new position

// Convert new position back to degrees
double newLatitude = newLatRad * (180 / Math.PI);
double newLongitude = newLonRad * (180 / Math.PI);

return (newLatitude, newLongitude);
}

Last edited:
Tom provided links referring to great circle calculations that should be enough precise for small distances
If a more precise result is required (especially for longer distances), calculation based on the earth ellipsoid model (WGS84) would be more appropriate
A script from Chris Veness is available here (easily translatable in C language)
Ellipsoid calculation
Other useful scripts for the spherical model are also available here
Spherical model scripts

Hervé

My go-to page for all formulae aviation-related:

Most are easily translated into C/C++.