AstroDistance
✖
AstroDistance
returns the physical distance to the astronomical object astro as currently observed from your geo location.
returns the physical distance to the astronomical object astro as currently observed from astro0.
returns the physical distance to astro as observed from astro0 on the given date.
Details

- AstroDistance computes distances between specific locations moving through space, such as centers of celestial bodies or points on their surfaces.
- In AstroDistance[astro1,astro0], the astro objects are given as astronomical entities, such as Entity["Planet","Mars"], representing the center of the celestial body, or as locations referred to their surface, such as GeoPosition[{lat,lon,h},"Mars"] or Entity["SolarSystemFeature", "OlympusMonsMars"]. Strings representing physical locations, such as "JupiterBarycenter", can also be used.
- In AstroDistance[astro,astro0], the observation astro0 must be a location within the solar system, but the target location astro can be a deep-sky object, such as stars or galaxies.
- The instant of observation, in the BCRS coordinates of the solar system, is determined by the second argument of AstroDistance, and it will be taken to be the current instant by default.
- In AstroDistance[astro,astro0], for astro objects outside the solar system, the result is always astrometric, i.e. giving the distance to the location from which the light was emitted and not to the location where astro was at the observation date.
- In AstroDistance[astro,astro0], for astro objects in the solar system, the result is corrected for light time by default, but can be made geometric using AstroDistance[astro,{astro0,"LightTime""Geometric"}].
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Find the current distance to the center of Venus from your geo location:

https://wolfram.com/xid/0g7ibutkrgy-fk8oop

Find the distance to the center of Venus as observed from a point on the surface of the Moon:

https://wolfram.com/xid/0g7ibutkrgy-yt2kyd

Plot the distance between the centers of Jupiter and Earth, between years 2015 and 2030:

https://wolfram.com/xid/0g7ibutkrgy-pdpc1f

Scope (5)Survey of the scope of standard use cases
Find the distance to the center of Jupiter as currently measured from the center of Mars:

https://wolfram.com/xid/0g7ibutkrgy-ncp3kb

This can also be expressed in these alternative forms:

https://wolfram.com/xid/0g7ibutkrgy-1jo55p


https://wolfram.com/xid/0g7ibutkrgy-2asmoc

Find the distance to the center of Jupiter from a point on the surface of Venus:

https://wolfram.com/xid/0g7ibutkrgy-qalxo1

Compare with the distance between centers:

https://wolfram.com/xid/0g7ibutkrgy-r6kuui

The difference is smaller than the radius of Venus, depending on the current geometric configuration:

https://wolfram.com/xid/0g7ibutkrgy-dgrysv

Use geo entities for locations on the surface of the Earth or entities representing solar system features:

https://wolfram.com/xid/0g7ibutkrgy-d8s3d8

Compute the between the Sun and the solar system barycenter:

https://wolfram.com/xid/0g7ibutkrgy-mlqv1h

Compute the distance for the next 100 years, in units of gigameters, or millions of kilometers:

https://wolfram.com/xid/0g7ibutkrgy-qt105p

Compute distances to a list of astronomical objects:

https://wolfram.com/xid/0g7ibutkrgy-r2polj

The result is given in QuantityArray form:

https://wolfram.com/xid/0g7ibutkrgy-n9p1y4

Use Normal to convert it to a list of Quantity distances:

https://wolfram.com/xid/0g7ibutkrgy-fs25ke

Applications (4)Sample problems that can be solved with this function
Construct a function that computes the geometric distance between the centers of Jupiter and Earth for a given Gregorian year:

https://wolfram.com/xid/0g7ibutkrgy-qjq6bh
Plot that distance between years 2020 and 2026:

https://wolfram.com/xid/0g7ibutkrgy-q789kv

Find the instant of closest approach in 2022:

https://wolfram.com/xid/0g7ibutkrgy-8zg4uv


https://wolfram.com/xid/0g7ibutkrgy-pju1te

Convert to the standard Gregorian calendar:

https://wolfram.com/xid/0g7ibutkrgy-ug7c5w

This is the distance between the Earth and the Sun for day d of year 2022:

https://wolfram.com/xid/0g7ibutkrgy-m9qxry
Due to the eccentricity of Earth's orbit, the distance oscillates around 1 AU during a year:

https://wolfram.com/xid/0g7ibutkrgy-m0ptvx

The perihelion of a planet is defined as the moment of closest approach to the Sun:

https://wolfram.com/xid/0g7ibutkrgy-dwjuvp

In 2022 it happened on January 4, around 7am GMT:

https://wolfram.com/xid/0g7ibutkrgy-g0bzpc

The aphelion is defined as the moment of maximum distance to the Sun:

https://wolfram.com/xid/0g7ibutkrgy-8j6ra9

In 2022 it happened on July 4, also around 7am GMT:

https://wolfram.com/xid/0g7ibutkrgy-dqi5c0

Find the distance to the star Vega:

https://wolfram.com/xid/0g7ibutkrgy-zq1yaf


https://wolfram.com/xid/0g7ibutkrgy-p6urjo

Compare to the distance observed from the Sun:

https://wolfram.com/xid/0g7ibutkrgy-p205da

It oscillates around 1 AU as the Earth orbits around the Sun during a year:

https://wolfram.com/xid/0g7ibutkrgy-lq3du3

The distance from the Sun also changes in time, due to proper motion of the star:

https://wolfram.com/xid/0g7ibutkrgy-3sfgu1

The distance is decreasing about 2.5 au per year, as reflected by the negative radial velocity of Vega:

https://wolfram.com/xid/0g7ibutkrgy-mmd68h

Compare the relative size of the Sun as currently observed from the different planets:

https://wolfram.com/xid/0g7ibutkrgy-oi8o0v


https://wolfram.com/xid/0g7ibutkrgy-7s1y1m


https://wolfram.com/xid/0g7ibutkrgy-w0jqd0

Properties & Relations (3)Properties of the function, and connections to other functions
AstroDistance[astro,obsrvr] is equivalent to AstroPosition[astro,obsrvr]["Distance"]:

https://wolfram.com/xid/0g7ibutkrgy-vrsonn

https://wolfram.com/xid/0g7ibutkrgy-s19y8s


https://wolfram.com/xid/0g7ibutkrgy-zwj29g


https://wolfram.com/xid/0g7ibutkrgy-030fft


https://wolfram.com/xid/0g7ibutkrgy-yas94b

AstroDistance[astro1,astro2] takes into account the time that light takes to propagate from astro1 to astro2. Compute the distance at which Jupiter can be seen from Mars on this date:

https://wolfram.com/xid/0g7ibutkrgy-xqdx27

https://wolfram.com/xid/0g7ibutkrgy-mjkszx

This is the time that light takes to travel that distance:

https://wolfram.com/xid/0g7ibutkrgy-isvtr4

This is the distance without taking into account that Jupiter moves during that time:

https://wolfram.com/xid/0g7ibutkrgy-kr7qmc

The difference is of the order of 10,000 miles:

https://wolfram.com/xid/0g7ibutkrgy-yu7wu8

This is the distance at which Mars can be seen from Jupiter at the same instant:

https://wolfram.com/xid/0g7ibutkrgy-6b7lf6

These results do not coincide:

https://wolfram.com/xid/0g7ibutkrgy-jetfdq

However, the computation without light-time correction does coincide:

https://wolfram.com/xid/0g7ibutkrgy-bx3m1t


https://wolfram.com/xid/0g7ibutkrgy-uuh5us

Use GeoPositionENU to compute the Euclidean distance to Principe Island from your location:

https://wolfram.com/xid/0g7ibutkrgy-k9h6ca


https://wolfram.com/xid/0g7ibutkrgy-mba0m8

GeoDistance gives distances on the surface of the Earth, which are therefore longer:

https://wolfram.com/xid/0g7ibutkrgy-nu6iik

Compare the Euclidean distance with the distance given by AstroDistance:

https://wolfram.com/xid/0g7ibutkrgy-qpqcxh

Deactivate all astrometric corrections to obtain full agreement:

https://wolfram.com/xid/0g7ibutkrgy-m8cqm

https://wolfram.com/xid/0g7ibutkrgy-df6a6n

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