# How can I convert my sky coordinate system (RA, Dec) into galactic coordinate system (l, b)?

I am an astro-particle physics PhD student trying to look for a simulation.

I was looking for a conversion formula for sky (or celestial or Equatorial) coordinate system using Right Ascension and Declination to l and b (galactic longitude and latitude).

Of course, since sky coordinate cannot contain Earth rotation or evolution effect, I also have UTC time for specific time.

Can anyone tell me the formula of RA, Dec and UTC to l and b?

• The conversion from RA and Dec to l and b does not depend on time (other than the equinox). Apr 12, 2023 at 21:10

Applying spherical trigonometry, it follows that the conversion from equatorial coordinates $$\alpha$$ and $$\delta$$ to galactic coordinates $$l$$ and $$b$$ is:

\left. \begin{aligned} \sin b &=\sin \delta_{NGP} \sin \delta + \cos \delta_{NGP} \cos \delta \cos ( \alpha - \alpha_{NGP}) \\ \sin ( l_{NCP}-l) &=\dfrac{\cos \delta \sin ( \alpha - \alpha_{NGP})}{\cos b} \\ \cos ( l_{NCP}-l) &=\dfrac{\cos \delta_{NGP}\sin \delta - \sin \delta_{NGP} \cos \delta \cos ( \alpha - \alpha_{NGP})}{\cos b} \end{aligned} \right \}

The equatorial coordinates (J2000) of the North Galactic Pole are:

$$\alpha_{NGP}=12^h 51^m 26.282^s=192.8595º=3.36603 \ rad$$

$$\delta_{NGP}=+27º 07’ 42.01’’=27.1283º=0.473479 \ rad$$

And the galactic longitude of the North Celestial Pole is:

$$l_{NCP}=122.932º=2.14557 \ rad$$

Reference:

Galactic coordinate system. (Scientific Library)

Reconsidering the Galactic coordinate system

Transformation of the equatorial proper motion to the Galactic system

Best regards.

This can be pretty easily accomplished in astropy using the following code:

import astropy.units as u
import astropy.time
import astropy.coordinates

coord = astropy.coordinates.TETE(
ra=25 * u.deg,
dec=45 * u.deg,
obstime=astropy.time.Time("2023-04-12")
)

coord = coord.transform_to(astropy.coordinates.Galactic())

print(coord.l.deg, coord.b.deg)


which outputs

131.65579483995242 -17.18683219126681


It works by specifying the right ascension and declination in the True Equator True Equinox coordinate system (known as astropy.coordinates.TETE) and then using the transform_to() method to convert the coordinates into galactic coordinates.

I actually made a converter for myself, with help from some old website that may not be around anymore. I think this may be what you're looking for: https://docs.google.com/spreadsheets/d/1wneDrG5xUMr1jMfPPOVLxPzkT72EMKj6dh52dzEHVAk/edit?usp=sharing

The J2K (Right Ascension and Declination) part is all the way at the bottom, I'm afraid; I might give everything its own sheet in the future. For that part, I used the following, gleaned from said old website:

For RIGHT ASCENSION,

Multiply hours by 15;

Divide minutes by 4;

Divide seconds by 239.999808000153;

For DECLINATION,

Leave the first number (degrees) as it is;

Divide minutes by 59.9999880000023;

Divide seconds by 3599.97120023039;