<p>You can get some of the numbers you need from JPL Horizons but you will need to have something go over the results to get the minimum and maximum values over the time span you are interested in.</p>
<p>If you go to to <a href="https://ssd.jpl.nasa.gov/horizons/app.html#/" rel="nofollow noreferrer">JPL Horizons</a> it will look something like this (you may get different defaults if you've been there before):
<a href="https://i.sstatic.net/eblmv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eblmv.png" alt="Initial JPL Horizons screen" /></a></p>
<p>You need to change the 'Ephemeris Type' to 'Vector Table' and then select the 'Target Body' by hitting Edit. You can then type in a target; putting in <code>Mars</code> will result in a list of options asking you to clarify which &quot;Mars&quot; you meant:
<a href="https://i.sstatic.net/9gWbR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9gWbR.png" alt="Entering Mars into the JPL Horizons Target Body selection box" /></a>
I'm assuming you want you want Mars (the planet) itself, rather than one of the spacecraft or the barycenter (slightly displaced from Mars's center due to Phobos and Deimos) so you should select 'MB: Mars'</p>
<p>Next you need to select the coordinate center where you want the vectors and distances <strong>from</strong> - in your example this will be the geocenter which is code <code>500</code> in Horizons (<code>@earth</code> works as well but will popup a list asking whether you want the geocenter or the Earth-Moon Barycenter):</p>
<p><a href="https://i.sstatic.net/tyTp4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tyTp4.png" alt="Selecting the coordinate center in JPL Horizons" /></a></p>
<p>You can then select the start and end times and the step size for the results that you want to cover. The default output is setup to provide a (somewhat) human readable HTML table with the full state vector (<span class="math-container">$x, y, z$</span> and velocities in <span class="math-container">$\dot{x}, \dot{y}, \dot{z}$</span>), the light travel time, the range and the range rate. Since you are just interested in the range, I suggest you go into 'Table Settings' and select option <code>6.</code> under output quantities to get the light time, range and range rate and set it to 'au and days'. For ease of later analysis, I would suggest you tick the <code>CSV output</code> as well so it looks like this:</p>
<p><a href="https://i.sstatic.net/FlUbE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FlUbE.png" alt="Configuring the vector output in JPL Horizons" /></a></p>
<p>(you can also have output in km and seconds rather than au and days if you want). Hitting 'Generate ephemeris' will then produce the output table. There will be a header at the top with details about the target body and the settings you have chosen and the main table will start (with <code>$$SOE</code>) after a table header:</p>
<p><a href="https://i.sstatic.net/8ATaR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8ATaR.png" alt="Vector table output for Mars from Earth from JPL Horizons" /></a></p>
<p>This will have the Julian and calendar datetimes in <a href="https://en.wikipedia.org/wiki/Barycentric_Dynamical_Time" rel="nofollow noreferrer">Barycentric Dynamical Time (TDB)</a> and then the light travel time (<code>LT</code>; in days in this case), the range/distance (<code>RG</code>; in au here) between Earth and Mars (geocenter to center of Mars or whatever you actually set the target and coordinate center to) and the range rate/change in distance (<code>RR</code>; in au/day) - the quantities in the output are explained in more detail below the table.</p>
<p>As for getting the minimum and maximum separation, as far as I know there is no way to do this in Horizons directly. You would need to download the results table (in CSV format) and load it into a spreadsheet to calculate a <code>MIN()</code> and <code>MAX()</code> on the <code>RG</code> column or use something like Python+AstroPy to read the table in and do the min/max on it.
If you <em>do</em> want to use Python, then you could use <a href="https://astroquery.readthedocs.io/en/latest/jplhorizons/jplhorizons.html" rel="nofollow noreferrer">astroquery</a> to query JPL Horizons directly and get an Astropy <code>Table</code> back which can be manipulated as you like.</p>

CC BY-SA 4.0
2022-02-22T14:16:39.567Z
Thank you for the answer. Is the `RR` radial velocity same as orbital velocity. Are these two different things?
Majoris
CC BY-SA 4.0
2022-02-24T16:19:00.430Z
No, it's just the change in the line of sight distance between Earth and Mars. Some of this will be due to the orbital motion of Mars but not all.
astrosnapper
CC BY-SA 4.0
2022-02-16T17:21:22.810Z
2022-02-17T01:49:30.630Z
2022-02-17T01:49:30.630Z
astrosnapper
<p>On this page, press Play [&gt;] and all your questions will be answered.
<a href="http://orbitsimulator.com/gravitySimulatorCloud/simulations/1645206515114_earth_mars.html" rel="nofollow noreferrer">http://orbitsimulator.com/gravitySimulatorCloud/simulations/1645206515114_earth_mars.html</a>
It uses JPL Horizons as a starting point on 1/1/2022, and integrates into the future / past, telling you the distance &amp; speed between Earth &amp; Mars. For closest &amp; furthest approach, look at Radial velocity. When it changes signs (which it does as it passes through 0 radial velocity), you are either at a max or a min.
<a href="https://i.sstatic.net/knTp7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/knTp7.png" alt="screenshot" /></a></p>

CC BY-SA 4.0
2022-02-18T17:58:13.613Z
2022-02-18T17:58:13.613Z
tony873004
<p>I am looking for distance measurement in AU between planets and Earth.</p>
<p>E.g. For Mars, Current distance, or distance of Mars from Earth at any given datetime, along with minimum (closest approach), maximum (farthest approach) distance of Mars in its orbit with respect to Earth's motion.</p>
<p>How do missions like Curiosity know the minimum (closest approach), maximum (farthest approach), and current distances between two bodies in their orbits?</p>
<p>JPL Horizons must have it, I played around but couldn't find the values I was looking for. How do I get these values from JPL Horizons? Is there any other source I have to use for this?</p>

CC BY-SA 4.0
2022-02-16T22:29:54.910Z
My answer [here](https://astronomy.stackexchange.com/a/47345/16685) has a live Sage / Python script that uses Horizons to graph the distance between bodies. It doesn't calculate maxima & minima, but it does calculate the mean.
PM 2Ring
CC BY-SA 4.0
2022-02-17T06:56:43.883Z
Interesting. Thank you!
Majoris
<orbit><planet><solar-system><orbital-mechanics><orbital-elements>
Planet's distance data from JPL Horizons - Mars Curiosity mission
Majoris
# Planet's distance data from JPL Horizons - Mars Curiosity mission

(Asked by: username_0 on 2022-02-16)

I am looking for distance measurement in AU between planets and Earth.

E.g. For Mars, Current distance, or distance of Mars from Earth at any given datetime, along with minimum (closest approach), maximum (farthest approach) distance of Mars in its orbit with respect to Earth's motion.

How do missions like Curiosity know the minimum (closest approach), maximum (farthest approach), and current distances between two bodies in their orbits?

JPL Horizons must have it, I played around but couldn't find the values I was looking for. How do I get these values from JPL Horizons? Is there any other source I have to use for this?

**Tags:** orbit, planet, solar-system, orbital-mechanics, orbital-elements
> **Comments:**
> **username_1**: My answer [here](https://astronomy.stackexchange.com/a/47345/16685) has a live Sage / Python script that uses Horizons to graph the distance between bodies. It doesn't calculate maxima & minima, but it does calculate the mean.  
> **username_0**: Interesting. Thank you!  

---

## 2 answers

### Answer by username_2 on 2022-02-16. Score: 3 | Accepted answer

You can get some of the numbers you need from JPL Horizons but you will need to have something go over the results to get the minimum and maximum values over the time span you are interested in.

If you go to to [JPL Horizons](https://ssd.jpl.nasa.gov/horizons/app.html#/) it will look something like this (you may get different defaults if you've been there before):
[![Initial JPL Horizons screen](https://i.sstatic.net/eblmv.png)](https://i.sstatic.net/eblmv.png)

You need to change the 'Ephemeris Type' to 'Vector Table' and then select the 'Target Body' by hitting Edit. You can then type in a target; putting in `Mars` will result in a list of options asking you to clarify which "Mars" you meant:
[![Entering Mars into the JPL Horizons Target Body selection box](https://i.sstatic.net/9gWbR.png)](https://i.sstatic.net/9gWbR.png)
I'm assuming you want you want Mars (the planet) itself, rather than one of the spacecraft or the barycenter (slightly displaced from Mars's center due to Phobos and Deimos) so you should select 'MB: Mars'

Next you need to select the coordinate center where you want the vectors and distances **from** - in your example this will be the geocenter which is code `500` in Horizons (`@earth` works as well but will popup a list asking whether you want the geocenter or the Earth-Moon Barycenter):

[![Selecting the coordinate center in JPL Horizons](https://i.sstatic.net/tyTp4.png)](https://i.sstatic.net/tyTp4.png)

You can then select the start and end times and the step size for the results that you want to cover. The default output is setup to provide a (somewhat) human readable HTML table with the full state vector ($x, y, z$ and velocities in $\dot{x}, \dot{y}, \dot{z}$), the light travel time, the range and the range rate. Since you are just interested in the range, I suggest you go into 'Table Settings' and select option `6.` under output quantities to get the light time, range and range rate and set it to 'au and days'. For ease of later analysis, I would suggest you tick the `CSV output` as well so it looks like this:

[![Configuring the vector output in JPL Horizons](https://i.sstatic.net/FlUbE.png)](https://i.sstatic.net/FlUbE.png)

(you can also have output in km and seconds rather than au and days if you want). Hitting 'Generate ephemeris' will then produce the output table. There will be a header at the top with details about the target body and the settings you have chosen and the main table will start (with `$$SOE`) after a table header:

[![Vector table output for Mars from Earth from JPL Horizons](https://i.sstatic.net/8ATaR.png)](https://i.sstatic.net/8ATaR.png)

This will have the Julian and calendar datetimes in [Barycentric Dynamical Time (TDB)](https://en.wikipedia.org/wiki/Barycentric_Dynamical_Time) and then the light travel time (`LT`; in days in this case), the range/distance (`RG`; in au here) between Earth and Mars (geocenter to center of Mars or whatever you actually set the target and coordinate center to) and the range rate/change in distance (`RR`; in au/day) - the quantities in the output are explained in more detail below the table.

As for getting the minimum and maximum separation, as far as I know there is no way to do this in Horizons directly. You would need to download the results table (in CSV format) and load it into a spreadsheet to calculate a `MIN()` and `MAX()` on the `RG` column or use something like Python+AstroPy to read the table in and do the min/max on it.
If you *do* want to use Python, then you could use [astroquery](https://astroquery.readthedocs.io/en/latest/jplhorizons/jplhorizons.html) to query JPL Horizons directly and get an Astropy `Table` back which can be manipulated as you like.

> **Comments:**
> **username_0**: Thank you for the answer. Is the `RR` radial velocity same as orbital velocity. Are these two different things?  
> **username_2**: No, it's just the change in the line of sight distance between Earth and Mars. Some of this will be due to the orbital motion of Mars but not all.  

---

### Answer by username_3 on 2022-02-18. Score: 2

On this page, press Play [>] and all your questions will be answered.
<http://orbitsimulator.com/gravitySimulatorCloud/simulations/1645206515114_earth_mars.html>
It uses JPL Horizons as a starting point on 1/1/2022, and integrates into the future / past, telling you the distance & speed between Earth & Mars. For closest & furthest approach, look at Radial velocity. When it changes signs (which it does as it passes through 0 radial velocity), you are either at a max or a min.
[![screenshot](https://i.sstatic.net/knTp7.png)](https://i.sstatic.net/knTp7.png)


---

