Method & assumptions
From two coordinates to a spherical distance.
Pathsphere answers a specific geometric question: on a sphere with the radius you entered, how far apart are two points along the shorter surface arc? The central angle does not depend on radius. The distance does.
The chosen model
A latitude is an angle north or south of the equator. A longitude is an angle around it. Positive latitude is north; positive longitude is east. Enter negative values for south and west. All four coordinates here belong to the same ideal sphere. The tool does not establish a real-world datum, transform coordinates, locate your device or consult a map.
The visible starting radius, 6371 km, is an illustrative spherical choice. A different radius may be more appropriate for your own model. The input field is deliberately visible so the model is inspectable. A sphere does not reproduce an ellipsoid, altitude, terrain, coastlines or a road network.
Why the angle calculation uses atan2
Each latitude/longitude pair can be represented by a unit vector from the sphere’s centre. The angle is obtained from the magnitude of their cross product and their dot product:
θ = atan2(|u × v|, u · v)
surface distance = R × θ
Here θ is in radians and R is in kilometres. The result is a shorter great-circle separation from 0 through π radians. For ordinary non-antipodal distinct points, a shorter arc exists between the points. For exact antipodes, there are several equally short arcs: the distance is πR, but the coordinates do not select a unique one.
Using atan2 with cross and dot products avoids the poor conditioning of taking acos of a value extremely close to 1 or −1. The implementation uses an equivalent rotated-sphere calculation. It calculates small coordinate differences before converting them to radians, and uses a co-latitude expression for cosine close to a pole. These choices help retain small positive distances; they do not make floating-point arithmetic exact.
Exact coordinate conventions
The decimal inputs are first parsed into exact bounded integer units: one billion units per degree for coordinates and one million per kilometre for radius. Exact comparisons identify poles, shared meridians, longitude aliases and antipodes before the approximate trigonometric calculation.
- Longitudes −180° and +180° identify the same meridian. Entering the same latitude with those two longitude labels gives the same point.
- At an exact pole, longitude is irrelevant. Two entries at +90° latitude are the same point regardless of longitude. The two opposite poles are antipodal.
- A longitude difference is normalized once into −180° through +180°. This is a difference convention; out-of-range longitude inputs are rejected rather than wrapped.
- No arbitrary “close enough” tolerance converts a nearby pair into an exact coincidence or antipode. The exact-coordinate classification is separate from a rounded numerical display.
Input bounds and accepted syntax
Latitude accepts −90 through +90 degrees; longitude accepts −180 through +180. Use digits before an optional decimal point, with one to nine digits after it. An optional ASCII + or − sign is accepted for coordinates. ASCII outer spaces and leading zeroes are allowed. A field may contain at most 32 characters, including those spaces. A dot requires digits on both sides: write 0.5 rather than .5.
Radius is an unsigned decimal greater than 0 and at most 1,000,000,000 km, with up to six fractional places and the same 32-character limit. Its minimum representable positive value is 0.000001 km. A plus or minus sign is not accepted for radius.
The tool rejects exponent notation such as 1e−9, comma decimals, tabs, degree symbols, DMS coordinates, hemisphere letters, units, NaN and trailing text. Write 0.000000001 for one billionth of a degree. Bounds are checked on the exact parsed decimal, so 90.000000001 and 180.000000001 are rejected.
Reading and saving the result
The page shows up to 12 significant digits. Very small positive values may use scientific notation so presentation does not turn them into zero. These are display choices, not claims about geographic accuracy or measurement precision. JSON retains the full finite numerical approximations produced by JavaScript Number arithmetic, along with the entered decimal strings and conventions. The displayed value is never fed back into the calculation.
Every edit clears the current result and disables exports. Select Calculate distance to use the new inputs. Reset example explicitly restores the starting values. Copy and download actions use only the current completed result; a late clipboard response cannot restore an outdated result in the page.
Where this is useful
Use it to check a geometry exercise, compare a pair of angular positions on a chosen spherical model, or understand how a radius assumption scales a distance. The worked examples include a quarter circle, dateline crossing, poles and a tiny near-pole separation. For an actual journey or navigation task, a more appropriate route and Earth model is needed.
Primary calculation references
- Wolfram MathWorld: Spherical Distance — central-angle and shortest surface-distance context.
- Wolfram MathWorld: Great Circle — latitude/longitude unit-vector geometry and spherical limits.
- Chris Veness: Vector-based geodesy — the original-author cross/dot atan2 expression and conditioning discussion.
These references support the mathematical model. They do not establish accuracy for every real-world location, route or coordinate datum.