Understanding Geodesic Distance on the WGS84 Ellipsoid
The shortest path between two points on the surface of the Earth is not a straight line, but a curve that conforms to the planet's shape. Because the Earth is not a perfect sphere, calculating this path requires modeling the planet as an ellipsoid. The Geodesic Distance Calculator measures this shortest surface path between two coordinates on the WGS84 ellipsoid, which is the standard reference ellipsoid for global positioning and mapping.
When you input coordinates, the tool calculates the precise distance, the initial bearing when leaving the origin, the final bearing when arriving at the destination, and the exact midpoint of the journey. It also provides a comparison against a simpler spherical great-circle calculation and displays a schematic map of the path.
All calculations are performed locally. Both coordinates and every result are computed in your browser and never leave this device.
Input Parameters and Interactive Controls
The calculator requires coordinate inputs for two distinct locations:
- Point A (origin): Requires a Latitude (decimal degrees from −90° to 90°) and a Longitude (decimal degrees from −180° to 180°).
- Point B (destination): Requires a Latitude (decimal degrees from −90° to 90°) and a Longitude (decimal degrees from −180° to 180°).
Coordinate Entry and Formatting Rules
Coordinates must be entered in decimal degrees. If your source data uses degrees-minutes-seconds (DMS), you must convert them to decimal format before entry. The conversion formula is:
Decimal Degrees = degrees + minutes / 60 + seconds / 3600
South and West values must be negative — for example, 40°42′46″N 74°00′21″W becomes 40.7128, −74.0060. However, you can keep N, S, E, or W letters on a decimal value, and the tool will automatically apply the correct positive or negative sign.
If you copy a "latitude, longitude" pair from a modern mapping application, you can paste the copied text directly into either coordinate field. The tool will automatically split the pair into the respective latitude and longitude boxes.
Interface Controls
- Load Tokyo–Osaka example: Instantly populates the input fields with pre-set coordinates for a quick demonstration of the tool's capabilities.
- Clear: Empties all coordinate input fields.
- Swap points: Swaps the coordinates of Point A and Point B, reversing the origin and destination.
Mathematical Models and Calculations
The calculator uses two distinct mathematical models to compute the distance between coordinates, allowing you to compare the accuracy differences between ellipsoidal and spherical representations of the Earth.
Ellipsoid Model (WGS84)
The primary calculation solves the inverse geodesic problem on the WGS84 ellipsoid using Karney’s algorithm. This method is highly precise and guarantees convergence for all pairs of points, including those that are nearly opposite (antipodal) or located near the poles. The ellipsoid parameters used are:
- Semi-major axis (a) = 6,378,137 m
- Flattening (f) = 1/298.257223563
The midpoint is calculated to lie at exactly half the geodesic arc length.
Sphere Model (Great-Circle)
For comparison, the tool also calculates the distance using the haversine formula on a sphere with a radius (R) of 6,371.0088 km, which is the International Union of Geodesy and Geophysics (IUGG) mean radius. The formulas used are:
a = sin²((Δφ) / 2) + cosφ₁ · cosφ₂ · sin²((Δλ) / 2)
d = 2R · atan2(√(a), √(1-a))
Where φ is latitude, λ is longitude, and R = 6,371.0088 km.
Understanding Bearings and Geodesics
A geodesic path on an ellipsoid does not maintain a constant compass heading. Because of the curvature of the ellipsoidal surface, the shortest path results in a continuously changing bearing.
- Initial bearing (leaving A): The direction you must head when departing Point A.
- Final bearing (arriving at B): The direction you will be heading when you arrive at Point B.
Azimuths are taken along the geodesic at A and at B, clockwise from true north, normalized to 0–360° (where 0° is true north and 90° is east). The initial bearing leaving Point A will differ from the final bearing arriving at Point B, except for journeys that run directly along the equator or straight along a meridian. These bearings are relative to true north, not magnetic compass readings.
Output Results and Visualizations
Once valid coordinates are entered, the tool displays the following outputs under the Geodesic result heading:
- Shortest surface distance: The calculated ellipsoidal distance.
- Initial bearing (leaving A)
- Final bearing (arriving at B)
- Midpoint: The exact coordinates of the halfway point.
- Sphere (R = 6,371.0088 km): Displays the spherical distance and the exact difference from the ellipsoid result formatted as
{distance} — {delta} from the ellipsoid result. - Schematic map of the geodesic from A to B: A visual representation of the path with the caption: "Equirectangular graticule; the arc shape is schematic, not a navigation chart."
The verification of these methods and sources was checked on 11 August 2026.
Rules, Edge Cases, and Error Handling
The calculator is designed to handle complex geographical edge cases, but it enforces strict validation rules on inputs.
Edge Cases
- Coincident Points: If Point A and Point B are identical, the distance is zero. The tool displays the message: "The two points are identical, so the distance is zero and no bearing is defined." The status bar updates to: "Both points are identical — the distance is zero."
- Antipodal and Polar Paths: The tool successfully calculates paths near the poles, across the 180° meridian, and between nearly opposite (antipodal) points on the globe by always following the shorter arc.
Error Messages
If an input violates formatting or physical boundaries, the tool displays specific error messages where {where} is replaced by "point A" or "point B", and {token} or {letter} is replaced by the invalid input:
- Non-numeric values:
{where}: “{token}” is not a number. - DMS formatting detected:
{where}: use decimal degrees (for example 48.8566), not degrees-minutes-seconds. - Incorrect hemisphere letter:
{where}: “{letter}” marks the wrong axis — use N or S for latitude and E or W for longitude. - Latitude out of bounds:
{where}: latitude must be from −90° to 90°. - Longitude out of bounds:
{where}: longitude must be from −180° to 180°.
Real-World Limitations
Distances follow the model Earth surface. Altitude, terrain, roads, and airspace routing are not included, so real travel is longer. Bearings are relative to true north; a magnetic compass reads a different angle that varies with place and date. For legal surveying or navigation sign-off, use professional geodetic software and official data.