# Eric Bergman-Terrell's Blog

Math Tip: How to Determine the Great Circle Distance Between Two Geographical Locations
October 4, 2010

Use the following method to determine the "great circle" distance, in miles, between two geological coordinates. Latitude is positive north of the equator. Longitude is negative west of Greenwich:

```public static double DistanceBetweenLocations(double Lat1Degrees,
double Lon1Degrees,
double Lat2Degrees,
double Lon2Degrees)
{
double Angle = AngleBetweenLocations(Lat1Degrees, Lon1Degrees,
Lat2Degrees, Lon2Degrees);

double Circumference = 24830.0; // miles at equator

return Circumference * Angle / (2.0 * Math.PI);
}

public static double AngleBetweenLocations(double Lat1Degrees,
double Lon1Degrees,
double Lat2Degrees,
double Lon2Degrees)
{

if (a < 0.0)
{
a = -a;
}

if (a > Math.PI)
{
a = 2.0 * Math.PI - a;
}

return Math.Acos(
);
}

public static double Radians(double degrees)
{
return degrees * Math.PI / 180.0;
}
```
Keywords: Great Circle, Latitude, Longitude