SphericalDistance
✖
SphericalDistance
returns the great-circle distance between points {θ1,ϕ1} and {θ2,ϕ2} on the surface of a unit sphere.
returns the geodesic distance between arbitrary-dimensional points on the surface of a unit hypersphere.
Details

- Spherical or hyperspherical coordinate vectors use the same conventions of CoordinateChartData and CoordinateTransformData, but with the leading r coordinate dropped.
- The geodesic distance on the surface of a radius-r hypersphere can be obtained by multiplying the result of SphericalDistance by radius r.
- Points on a 2D sphere can also be specified using GeoPosition[{lat,lon}] notation, with latitudes and longitudes in degrees.
- SphericalDistance threads over lists of points, with SphericalDistance[point,points] returning a list of distances, and SphericalDistance[points1,points2] returning a matrix of distances.
- When working with numerical data, SphericalDistance does not accept complex-valued inputs and returns only real-valued outputs.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
The distance between a pair of points on the unit sphere:

https://wolfram.com/xid/0n4frnhi1ua-h5i9h8

The distance between a pair of points on the unit 3-sphere:

https://wolfram.com/xid/0n4frnhi1ua-g3bx4y

Take several points on the equator of the sphere:

https://wolfram.com/xid/0n4frnhi1ua-gf2h8b

Show that they are all equidistant from the north pole:

https://wolfram.com/xid/0n4frnhi1ua-4ihq9z

Scope (5)Survey of the scope of standard use cases
SphericalDistance accepts exact numerical inputs:

https://wolfram.com/xid/0n4frnhi1ua-o048cf

SphericalDistance accepts arbitrary-precision numerical inputs:

https://wolfram.com/xid/0n4frnhi1ua-oozu6n

SphericalDistance works with symbolic inputs:

https://wolfram.com/xid/0n4frnhi1ua-iidvte

Calculate a rectangular DistanceMatrix and display the results with ArrayPlot:

https://wolfram.com/xid/0n4frnhi1ua-k5hu39

SphericalDistance accepts points in GeoPosition[{lat,lon}] notation:

https://wolfram.com/xid/0n4frnhi1ua-i4t1wj

Use GeoPosition lists of points:

https://wolfram.com/xid/0n4frnhi1ua-7bqg82

Applications (3)Sample problems that can be solved with this function
Generate three points in an octant of the unit sphere:

https://wolfram.com/xid/0n4frnhi1ua-jymolz

Find edge lengths of the corresponding spherical triangle:

https://wolfram.com/xid/0n4frnhi1ua-v46zkk

Verify the spherical triangle inequality:

https://wolfram.com/xid/0n4frnhi1ua-zk6hjj

Define a parametric trajectory in spherical coordinates:

https://wolfram.com/xid/0n4frnhi1ua-m1s8qj

Represent the curve as a series of points and plot:

https://wolfram.com/xid/0n4frnhi1ua-8idyhx

https://wolfram.com/xid/0n4frnhi1ua-ouz7mc

Estimate the curve's arc length:

https://wolfram.com/xid/0n4frnhi1ua-nqozke

Take the angular coordinates for the vertices of an octahedron:

https://wolfram.com/xid/0n4frnhi1ua-smhm22

Compute distances from one point to all others:

https://wolfram.com/xid/0n4frnhi1ua-2bxcyl

Find the symmetric matrix of distances between any pair of points:

https://wolfram.com/xid/0n4frnhi1ua-bfx609


https://wolfram.com/xid/0n4frnhi1ua-nm94dx

Properties & Relations (5)Properties of the function, and connections to other functions
Calculate an angular distance along the great circle :

https://wolfram.com/xid/0n4frnhi1ua-t5uhh

Calculate the same distance along the great circle :

https://wolfram.com/xid/0n4frnhi1ua-pwatkc

Both results are just the difference of component values:

https://wolfram.com/xid/0n4frnhi1ua-h0o02y

Choose two points on a sphere:

https://wolfram.com/xid/0n4frnhi1ua-jz467u

Convert to Cartesian coordinates on a unit sphere:

https://wolfram.com/xid/0n4frnhi1ua-w1v9

Compare the results of SphericalDistance and VectorAngle:

https://wolfram.com/xid/0n4frnhi1ua-hcsb86


https://wolfram.com/xid/0n4frnhi1ua-nynqra


https://wolfram.com/xid/0n4frnhi1ua-w8eql7

The result of EuclideanDistance is always less than the result of SphericalDistance:

https://wolfram.com/xid/0n4frnhi1ua-0fhjdb


https://wolfram.com/xid/0n4frnhi1ua-1j4lt1

Locate two stars in the constellation Orion:

https://wolfram.com/xid/0n4frnhi1ua-5pwaby

https://wolfram.com/xid/0n4frnhi1ua-2xmhcp

Calculate their angular separation in radians:

https://wolfram.com/xid/0n4frnhi1ua-zx5hqs

Compare with the result of AstroAngularSeparation:

https://wolfram.com/xid/0n4frnhi1ua-owleuo

Specify coordinates using GeoPosition:

https://wolfram.com/xid/0n4frnhi1ua-wliuch

https://wolfram.com/xid/0n4frnhi1ua-ng3kue

Compute the GeoDistance on an ellipsoidal Earth:

https://wolfram.com/xid/0n4frnhi1ua-p2n9g3

Divide by Earth's average radius to a comparable result:

https://wolfram.com/xid/0n4frnhi1ua-kj04z1

Calculate a symbolic distance between arbitrary points on a sphere:

https://wolfram.com/xid/0n4frnhi1ua-hir8iy

Compare with the result of VectorAngle, simplified over the reals:

https://wolfram.com/xid/0n4frnhi1ua-ljzn2h

Possible Issues (1)Common pitfalls and unexpected behavior
Different usages of SphericalDistance may return different results:

https://wolfram.com/xid/0n4frnhi1ua-p7vn0c


https://wolfram.com/xid/0n4frnhi1ua-538kha

Check that both results are equivalent:

https://wolfram.com/xid/0n4frnhi1ua-4nw3vz

Neat Examples (1)Surprising or curious use cases
List spherical coordinates for the vertices of a tetrahedron:

https://wolfram.com/xid/0n4frnhi1ua-lrw38i

Plot the tetrahedron with arcs between its vertices:

https://wolfram.com/xid/0n4frnhi1ua-pnnkap

Verify all points have equal angular separation:

https://wolfram.com/xid/0n4frnhi1ua-i3d2bv

Wolfram Research (2023), SphericalDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/SphericalDistance.html.
Text
Wolfram Research (2023), SphericalDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/SphericalDistance.html.
Wolfram Research (2023), SphericalDistance, Wolfram Language function, https://reference.wolfram.com/language/ref/SphericalDistance.html.
CMS
Wolfram Language. 2023. "SphericalDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SphericalDistance.html.
Wolfram Language. 2023. "SphericalDistance." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SphericalDistance.html.
APA
Wolfram Language. (2023). SphericalDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SphericalDistance.html
Wolfram Language. (2023). SphericalDistance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SphericalDistance.html
BibTeX
@misc{reference.wolfram_2025_sphericaldistance, author="Wolfram Research", title="{SphericalDistance}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/SphericalDistance.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_sphericaldistance, organization={Wolfram Research}, title={SphericalDistance}, year={2023}, url={https://reference.wolfram.com/language/ref/SphericalDistance.html}, note=[Accessed: 29-March-2025
]}