# Getting state vectors from JPL Horizons ephemerides

I'm simulating the Sun-Earth-Moon system by numerical integration of equation of motion. I've confused a little bit in JPL Horizons ephemerides.

Could anyone explain (if possible, on pictures), how to use it to achieve

• Earth coordinates in Sun coordinate system or in Solar system baricenter coordinate system
• Sun coordinates in Solar system baricenter coordinate system
• Moon coordinates in Earth coordinate system
– uhoh
Oct 30 '18 at 3:31

For quick and easy experimenting with NASA Horizons, I set up a page:

http://win98.altervista.org/space/exploration/NHUGUI.html

I also tried explaining the possible "quantities" (for "OBSERVER" table) visually rather than by text like in original documentation, as it is very hard to describe by text a graphical concept (it looks like Horizons help dates back to DOS epoch...)

http://win98.altervista.org/space/exploration/quantities.html

For VECTOR table, my interface is also useful because it allows immediately viewing the output on the same window:

For VECTOR table I also setup a specific page which allows plotting in 2d and 3d the trajectory of any body w.r.t. any other; it was designed to track spacecrafts, but of course it works also for planets and satellites:

Parameters:

• orbiter=301 (moon)
• center=@399 (earth)
• start=2021-07-15 (start time)
• stop=2021-08-16 (end time)
• step=1d (time step)
• 3dzoom=500000 (zoom of 3d plot, in km)
• radius=6000 (radius of center body, in km, for calculating altitude in 2d plot)

ID#      Name                               Designation  IAU/aliases/other
-------  ---------------------------------- -----------  -------------------
0  Solar System Barycenter                         SSB
3  Earth-Moon Barycenter                           EMB
10  Sun                                             Sol
301  Moon                                            Luna
399  Earth                                           Geocenter

Full list of known bodies: https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND=%27*%27&CENTER=%27*%27

Keywords: Horizons tutorial

I'll work one example all the way through, and include the exact output you should get so you can check your results.

Then you can change one item at a time to get the rest of the things you need.

Ephemeris Type

Select the Vector Table:

Target Body

Type the word "Earth" into the search box:

It searches, and finds two options. Choose "Earth Geocenter":

Coordinate Origin

Use observatory code numbers (if you know them) or names. For example, enter "675" to select the Palomar Mountain main site. Or, enter "palomar" for a list of matching sites. Use "Geocentric or code "500" for geocentric. You can also enter Horizons-specific non-topocentric location codes. For example, use "@sun" to place the observer at the center of the sun, "@0" to select the solar-system barycenter, or "Viking 1@499" to select the Viking 1 landing site on Mars (499). To see all sites available for a specific body, use "@body" where body is body ID. For example, "@499" will show all sites on Mars. See the Horizons documentation for more details on center/observer location codes.

"@0" will set your origin to the Solar System Barycenter

Time Span

Table Settings

You need all six values to build your initial state vector: $$x, y, z, v_x, v_y, v_z$$:

Make all options settings look exactly like this:

Display/Output

Choose HTML so you can see it on your screen. If you like it then change to download/save

If you save the file, and extract the positions of Earth, you get the following. Z stays very close to zero because the reference plane is set to ecliptic.

2458164.500000000, A.D. 2018-Feb-15 00:00:00.0000,
-1.222658746534817E+08,  8.358147121331073E+07, -1.998641833709925E+04,
-1.716151037847111E+01, -2.480720984441618E+01,  2.472874945897985E-03,

If you want to use earth mean equator for the reference plane (which is like the equator of the celestial sphere (declination = 0) then you set it to mean equator:

and you'll get this:

2458164.500000000, A.D. 2018-Feb-15 00:00:00.0000,
-1.222658746534817E+08,  7.669245070020768E+07,  3.322846272752656E+07,
-1.716151037847111E+01, -2.276115369540082E+01, -9.865472560113437E+00,

• For today, in the coordinate system with center in Solar System Baricenter, the Earth coordinates: X =-7.86E-01 Y = 6.00E-01 Z =-1.37E-04 | Sun coordinates: X = 1.55E-03 Y = 6.33E-03 Z =-1.14E-04.... IS IT OK? Feb 14 '18 at 17:44
• I don't know where your numbers come from, and it doesn't matter. The numbers that I show in the answer are the output, and you can see the time and date in the beginning. Horizons is pretty much the best you can get anywhere. These are the right numbers! You can run Horizons again and select AU and AU/day if you want, or you can convert these to AU.
– uhoh
Feb 14 '18 at 17:49
• @TarlanMammadzada no problem! To get good results integrating orbits near Earth, you'll need time steps of the order of a one or two minutes (or less) because the satellite's period is only ~100 minutes. You can get such small steps from Horizons, or you can get larger steps from Horizons and interpolate them. Some day you will wonder how Horizons works, and so I'll tell you now; it's a very big, beautiful, flexible interpolator, and the tables it interpolates are called ephemerides and/or kernels.
– uhoh
Feb 14 '18 at 18:16
• @AaronFranke since conversion from kilometers to meters is trivial (multiply by exactly 1000) it seems that NASA trusts us to be able to do it for ourselves.
– uhoh
May 26 '19 at 13:22
• @MagicOctopusUrn I am trying to setup such a GUI for Horizons: win98.altervista.org/space/exploration/NHUGUI.html Aug 19 '20 at 15:20

Look at the Vector option. For the target, use the "satellite". For the origin, use the appropriate body id, preferably the Barycenter. Some example IDs:

• Solar Barycenter- 0
• Earth Barycenter- 399
• Mars Barycenter- 499
• Just to ensure. I selected Type- Vector, Targer- Earth, Origin- Baricenter. So, is it coordinates of Earth in Baricenter coordinate system? Feb 14 '18 at 13:54
• Yes, that is correct. Feb 14 '18 at 22:11