### Transformation from Geocentric Coordinates into Equatorial Coordinates?

I have the moon's position in equatorial coordinates (RA and Dec) and now I want to calculate same moon's position in terms of earth centered coordinates i.e. Geocentric (latitude & longitude). My main goal is to establish a c++-code that gives me this transformation from RA,Dec to Lat,Lon and vice versa.

*EDIT*: More precisely, I have moon’s position in equatorial geocentric coordinates with following details:*Origin: Center of Earth**Lat : Declination With fundamental Plane: Celestial Equator**Lon : R.A. With Primary direction: Vernal Equinox*And I am able to obtain the moon’s position corresponding to a specific Modified Julian Date (MJD). I am also able to calculate moon’s position in xyz-coordinates by following calculations

$X= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*cos(ra_moon*deg2rad);$

$Y= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*sin(ra_moon*deg2rad);$

$Z= EarthMoon*cos(PI/2.-dec_moon*deg2rad);$where EarthMoon is the distance between Earth and Moon. Further, I am converting them into Horizon Coordinates (topocentric) w.r.t to an observer at a specific location by using my subroutine and this part done.

Further, I am initiating my simulated CR-particles from observer site. E.g. vCR[3]= {R,lat,lon}

*vCR[3]={Rearth+2300, 31.30, 55.74}*//Geocentric CS (earth-based)And converting them into Geocentric Cartesian coordinates(x,y,z). Finally, I have

*vM[3]={X,Y,Z};*in Equatorial geocentric coordinate system*vCR[3]={x,y,z};*in Geocentric Coordinate System i.e. Earth basedThat is my particular question in which I want to make vM[moon position] and vCR[CR position] to lie in same coordinates to get my final result. i.e. transformation from Geocentric (R,lat,lon) into Equatorial Geocentric (h,R.A,Dec).

**Note**: For vCR[3]: zero-longitude is the Prime Meridian, Greenwich whereas for vM[3] it’s vernal equinox in celestial sphere there is the difference.If I understand your question correctly than your problem is that the primary direction of

`vCR[3]`

is the intersection between the prime meridian and the Earth's equator, instead of the vernal equinox. The geographical latitude is the same as the declination, but to get the right ascension you will need to rotate your coordinates around the z-axis by an amount that is equal to the sidereal time at Greenwich ($\theta_G$). This is done, simply by replacing the the longitude (lon) with the sidereal time at your location $\theta = \theta_G-lon$.`x = R* cos(lat) * cos(theta);`

y= R* cos(lat) * sin(theta);

z = R* sin(lat);

vCR[3]={x,y,z};where

`theta`

is the sidereal time $\theta$.The sidereal time is not a time but actually an angle that gives the right ascension of objects that are at that moment crossing the local meridian (i.e. the line between South and the Celestial north pole, for observers on the northern hemisphere). It is in a sense the longitude of your position on Earth if the geographical coordinate system were to rotate along with the celestial sphere.

EDIT: To calculate the Sidereal time, you can use the method explained in Astronomical Algorithms by Jean Meeus:

$$T = \frac{JD-2451545.0}{3625}$$

$$\theta_0 = 100.46061837 + 36000.770053608 T + 0.000387933 T^2 - \frac{T^3}{38710000}$$The sidereal time is expressed in degrees.

Then express the UTC time as an angle:

$$t = 15h+0.25m+\frac{0.25}{60}s$$

where $h$ is the number of hours, $m$, the number of minutes, and $s$ the number of seconds.

The sidereal time at Greenwich at the specified time is then:

$$\theta_G = \theta + 1.00273790935*t $$

and the local sidereal time is:

$$\theta = \theta_G - L$$

Where $L$ is the geographical longitude (positive west from Greenwich).

Yes this time you understand my problem quite well and the only difference is in longitude and Right ascension (R.A). According to my knowledge, sidereal time is the time taken by earth to spin with respect to the STARS not Sun. Further, Hour Angle = Sidereal time - R.A and if I am not wrong then here you mention theta is basically Hour angle which is actually an angle. If this is the situation so I need to calculate first sidereal time w.r.t Greenwich. i.e. GST. So may you further guide me to how to calculate this? What I already have is modified Julian date (mjd) only.

No, the hour angle is the angle between the meridian (the line from south through zenith to the celestial north pole) and the longitudinal component of the position of the object. If RA = sidereal time then the hour angle is 0, i.e. the object is on the meridian. The sidereal time is, therefore, the RA of the objects that at that moment pass through the meridian. The sidereal time is NOT a time (which would also imply a date), it is an angle.

I am working on it and i hope it will work ..... thanks for all this

One more relevant question: If we want to convert geocentric (alt,lat,lon) into geocentric cartesian coordinates (x,y,z), we simply need to use spherical to cartesian transformation formulas i.e. x= R+h*sin(lat)*cos(lon), y= R+h*sin(lat)*cos(lon), z=R+h*cos(lat) Or Same formulas with these modifications lat= lat-90, lon = lon+180.

I'm not sure I understand your question correctly. If you have geocentric coordinates you have longitude and latitude **and distance** ($d$), I'm not sure what you mean by alt. To get the cartesian coordinates: $x=d\cos(lon)\cos(lat)$, $y=d\sin(lon)\cos(lat)$ and $z=d\sin(lat)$.

Exactly, I was just expressing *d* as **alt** here and these are the right relations, I just want to re-confirm. Thanks.

I got some results for local sidereal time by following formulation mentioned above but I have doubt either they are correct or not. Can you suggest me a way to re-check my results for further use.

You can use an online calculator such as Skywatch from Western Washington University Planetarium

I think, you are mixing two different concepts. Equatorial coordinates are coordinates in the equatorial coordinate system (as opposed to the ecliptical, galactic, super galactic, or horizontal coordinate systems). The coordinates also refer to a specific origin. This origin might be heliocentric (centre of the Sun), baryocentric (centre of mass of the Solar System), geocentric (centre of the Earth), or topocentric (a specific location on the Earth's ellipsoid).

So you may have heliocentric equatorial coordinates, geocentric equatorial coordinates, or topocentric equatorial coordinates.

From your question I infer that you have

*geocentric*coordinates of the Moon and you want to convert them to*topocentric*(not geocentric!) coordinates for an observer at a specific location (latitude and longitude) on the Earth.The best way to go about this would be to:

First, convert you geocentric equatorial coordinates to its rectangular equivalent (i.e. find the $X_M$, $Y_M$, and $Z_M$ equatorial coordinates).

Second calculate the $X_o$, $Y_o$, and $Z_o$ coordinates of the observer on Earth in the equatorial system.

Third, subtract the $X_o$, $Y_o$, and $Z_o$ coordinates of the observer from the $X_M$, $Y_M$, and $Z_M$ coordinates of the Moon.

Finally, convert the coordinates back to spherical coordinates, i.e. the $X$, $Y$, and $Z$ coordinates back to right ascension, declination, and distance.

If you have the geocentric right ascension $\alpha_M$, declination $\delta_M$, and distance $d_M$, then you can get the rectangular coordinates from:

$$ X_M = d_M \cos(\alpha_M) \cos(\delta_M) $$

$$ Y_M = d_M \sin(\alpha_M) \cos(\delta_M) $$

$$ Z_M = d_M \sin(\delta_M) $$The $X$-axis is pointed towards the vernal equinox, and the $Z$-axis is pointed towards the celestial north pole (i.e. parallel with the Earth's rotation axis).

For the rectangular equatorial coordinates of the observer, you need the geographical latitude ($\phi$) and longitude ($L$), the elevation ($H$) and the sidereal time ($\theta$).

To calculate the rectangular coordinates of the observer is a bit more difficult as the Earth's surface is (approximately) an ellipsoid. The following is taken from Jean Meeus book, Astronomical Algorithms:

$$b' = 0.99664719$$

which is a measure of the ellipsoid.

$$ u = \arctan(b' \tan(\phi)) $$

$$ \rho\sin(\phi) = R_E b' \sin(u) + H \sin(\phi)) $$

$$ \rho\cos(\phi) = R_E \cos(u) + H \cos(\phi) $$where $R_E = 6378140.0 \textrm{m}$ is the Earth's radius.

We can then calculate the rectangular geocentric equatorial coordinates of the observer:$$ X_o = \rho \cos(\phi) \cos(\theta)$$

$$ Y_o = \rho \cos(\phi) \sin(\theta)$$

$$ Z_o = \rho \sin(\phi) $$The topocentric rectangular equatorial coordinates of the Moon are then:

$$ X = X_M - X_o $$

$$ Y = Y_M - Y_o $$

$$ Z = Z_M - Z_o $$Then convert back to spherical coordinates:

$$ d' = \sqrt{X^2 + Y^2 + Z^2} $$

$$ \alpha' = \arctan \left(\frac{Y}{X} \right) $$

$$ \delta' = \arcsin \left(\frac{Z}{d'} \right) $$You then have the topocentric equatorial coordinates of the Moon: right ascension $\alpha'$, declination $\delta'$ and the distance $d'$.

You will have to make sure that $\alpha'$ is in the correct quadrant. Programmatically this can be easily achieved with the

`atan2`

function, i.e.`alpha = atan2(y,x)`

.I haven't tested these formulae so I hope that they are correct.

First of all, thanks for your kind reply. Now directly come to my point. Actually, I am dealing with two things simultaneously. More precisely, I have moon’s position (yes) in equatorial geocentric coordinates with following details: Origin: Center of Earth Lat : Declination With fundamental Plane: Celestial Equator Lon : R.A. With Primary direction: Vernal Equinox And I am able to obtain the moon’s position corresponding to a specific Modified Julian Date (MJD) by recalling a subroutine like moon_pos(mjd, &ra_moon, &dec_moon);

Then `ra_moon` will contain the right ascension of the moon ($\alpha_M$) and `dec_moon` will contain the declination of the moon ($\delta_M$), which you can use in the formulae above. You will, however, also need the distance to the moon, otherwise you will never be able to determine topocentric coordinates. You can only find the parallax if you know the distance.

the previous comment was not complete because of limitation of words here so i wrote it down again so sorry for this inconvenience.

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM

barrycarter 6 years ago

See C CSPICE at http://naif.jpl.nasa.gov/naif/tutorials.html which include source code.