<p>To transform an equatorial $(x, y, z)$
into a galactic $(x_G, y_G, z_G)$, the
<a href="https://gaia.esac.esa.int/documentation//GDR1/Data_processing/chap_cu3ast/sec_cu3ast_intro.html#SS7" rel="nofollow noreferrer">Gaia data release 1 documentation, section 3.1.7</a>, uses</p>

<p>$$
\begin{bmatrix} x_G \\ y_G \\ z_G\end{bmatrix}
= \mathbf{A}'_G
\begin{bmatrix} x \\ y \\ z \end{bmatrix}
$$</p>

<p>where</p>

<p>$$
\mathbf{A}'_G = \begin{bmatrix}
{−0.054876} ~ {−0.873437} ~ {−0.483835} \\
{+0.494109} ~ {−0.444830} ~ {+0.746982} \\
{−0.867666} ~ {−0.198076} ~ {+0.455984}
\end{bmatrix}
$$
is composed of three coordinate frame rotations
$$
\mathbf{A}'_G = \mathbf{R}_Z(-l_\Omega)
~ \mathbf{R}_X(90^\circ - \delta_G)
~ \mathbf{R}_Z(\alpha_G + 90^\circ)
$$
with the north galactic pole at equatorial coordinates
$(\alpha_G = 192.859^\circ, \delta_G = +27.128^\circ)$
and the galactic equator crossing the celestial equator at galactic longitude
$l_\Omega = 32.932^\circ$.</p>

<p>This is equivalent to the transformation defined in the
<a href="https://www.cosmos.esa.int/web/hipparcos/catalogues" rel="nofollow noreferrer">Hipparcos catalogue</a>, volume 1, section 1.5.3.</p>

<p><a href="http://adsabs.harvard.edu/abs/1989A&amp;A...218..325M" rel="nofollow noreferrer">Murray 1989</a> and
<a href="https://www.aanda.org/articles/aa/full_html/2011/02/aa14961-10/aa14961-10.html" rel="nofollow noreferrer">Liu 2011</a>
give similar matrices whose elements differ after 6 decimal places, which matters only if you require sub-arcsecond precision.</p>

CC BY-SA 3.0
2018-03-31T14:23:09.717Z
Thank you! I can confirm this formula seems to be correct based on the results
AnythingElse
CC BY-SA 3.0
2018-03-30T19:24:09.227Z
2018-03-30T21:35:58.000Z
2018-03-30T21:35:58.000Z
Mike G
<p>I'm using a star database (the <a href="http://www.astronexus.com/hyg" rel="nofollow noreferrer">HYG database</a>) which has xyz positions and velocities for the stars. This has +X towards the vernal equinox, +Z towards north celestial pole, +Y towards Right Ascension 6 hours and it's based on J2000 and centered on the sun.</p>

<p>I'd like to convert these to a Cartesian Galactic coordinate system centered on the sun, with +X pointing to its center and +Z angled so that it shoots out of the galactic plane on the north side.</p>

<p>This should just be a simple rotation, but after a lot of searching I can't seem to find the rotation to use, nor some way of converting it through a third system.
Does anyone know how to obtain the correct rotation matrix here? (or some other method of rotation) </p>

<galaxy><coordinate>
How to convert from Cartesian J2000 coordinates to Cartesian Galactic coordinates?
AnythingElse
# How to convert from Cartesian J2000 coordinates to Cartesian Galactic coordinates?

(Asked by: username_0 on 2018-03-30)

I'm using a star database (the [HYG database](http://www.astronexus.com/hyg)) which has xyz positions and velocities for the stars. This has +X towards the vernal equinox, +Z towards north celestial pole, +Y towards Right Ascension 6 hours and it's based on J2000 and centered on the sun.

I'd like to convert these to a Cartesian Galactic coordinate system centered on the sun, with +X pointing to its center and +Z angled so that it shoots out of the galactic plane on the north side.

This should just be a simple rotation, but after a lot of searching I can't seem to find the rotation to use, nor some way of converting it through a third system.
Does anyone know how to obtain the correct rotation matrix here? (or some other method of rotation)

**Tags:** galaxy, coordinate


---

## 1 answers

### Answer by username_1 on 2018-03-30. Score: 1 | Accepted answer

To transform an equatorial $(x, y, z)$
into a galactic $(x\_G, y\_G, z\_G)$, the
[Gaia data release 1 documentation, section 3.1.7](https://gaia.esac.esa.int/documentation//GDR1/Data_processing/chap_cu3ast/sec_cu3ast_intro.html#SS7), uses

$$
\begin{bmatrix} x\_G \\ y\_G \\ z\_G\end{bmatrix}
= \mathbf{A}'\_G
\begin{bmatrix} x \\ y \\ z \end{bmatrix}
$$

where

$$
\mathbf{A}'\_G = \begin{bmatrix}
{−0.054876} ~ {−0.873437} ~ {−0.483835} \\
{+0.494109} ~ {−0.444830} ~ {+0.746982} \\
{−0.867666} ~ {−0.198076} ~ {+0.455984}
\end{bmatrix}
$$
is composed of three coordinate frame rotations
$$
\mathbf{A}'\_G = \mathbf{R}\_Z(-l\_\Omega)
~ \mathbf{R}\_X(90^\circ - \delta\_G)
~ \mathbf{R}\_Z(\alpha\_G + 90^\circ)
$$
with the north galactic pole at equatorial coordinates
$(\alpha\_G = 192.859^\circ, \delta\_G = +27.128^\circ)$
and the galactic equator crossing the celestial equator at galactic longitude
$l\_\Omega = 32.932^\circ$.

This is equivalent to the transformation defined in the
[Hipparcos catalogue](https://www.cosmos.esa.int/web/hipparcos/catalogues), volume 1, section 1.5.3.

[Murray 1989](http://adsabs.harvard.edu/abs/1989A&A...218..325M) and
[Liu 2011](https://www.aanda.org/articles/aa/full_html/2011/02/aa14961-10/aa14961-10.html)
give similar matrices whose elements differ after 6 decimal places, which matters only if you require sub-arcsecond precision.

> **Comments:**
> **username_0**: Thank you! I can confirm this formula seems to be correct based on the results  

---

