# How to convert from Cartesian J2000 coordinates to Cartesian Galactic coordinates?

I'm using a star database (the HYG database) 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)

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, 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, volume 1, section 1.5.3.

Murray 1989 and Liu 2011 give similar matrices whose elements differ after 6 decimal places, which matters only if you require sub-arcsecond precision.

• Thank you! I can confirm this formula seems to be correct based on the results – AnythingElse Mar 31 '18 at 14:23