# How to calculate geocentric transformation to heliocentric coordinates?

I have Sun data (lon+lat+distance) in geocentric coordinates:

but I want to visualize in heliocentric way. How to calculate that?

Earth's position as seen from the Sun is directly opposite the Sun's position as seen from Earth, at the same distance. In ecliptic coordinates, \begin{align} l_\oplus &= \lambda_\odot \pm 180^\circ \\ b_\oplus &= -\beta_\odot \\ r_\oplus &= \mathit{\Delta}_\odot \end{align}

The heliocentric position of the Sun is always at the origin ($$r=0$$) by definition.

• so, when i calculate geosentric, just skip L+180 and get heliocentric. Oct 23 '20 at 23:47

For some reason, I just saw this question only now… Maybe I’m too late, but anyway: Here goes…

To convert from heliocentric to geocentric and vice versa is more than just adding 180° to the longitude, because you’re also changing point of view. You have to first convert your spherical heliocentric (or geocentric) positions into rectangular positions. This is done with the following formulas:

$$X = R\ \text{cos}\ B\ \text{cos}\ L\\ Y = R\ \text{cos}\ B\ \text{sin}\ L\\ Z = R\ \text{sin}\ B$$

Where R is the distance to the object (which is lacking from your table; hopefully, you have the data somewhere else), B is its latitude, and L is its longitude.

Then you need to somehow find the heliocentric position of the Earth or the geocentric position of the Sun. Let’s call those $$X_0$$, $$Y_0$$, and $$Z_0$$.

Then the geocentric (or heliocentric) position is found by $$X_h = X + X_0$$, $$Y_h = Y + Y_0$$, $$Z_h = Z + Z_0$$, which you can convert to longitude, latitude, and distance once again by:

$$r = \sqrt{X_h^2 + Y_h^2 + Z_h^2} \\ l = \displaystyle \text{atan2}\ \frac{Y_h}{X_h} \\ b = \displaystyle \text{asin}\ \frac{Z_h}{r} = \text{atan2}\ \frac{Z_h}{\sqrt{X_h^2 + Y_h^2}}$$

Where atan2 is the second arctangent function that’s available in most programming language, and which gives you the proper quadrant.

Hope this helps.