<p>I'm not sure Orekit can handle the Galactic coordinate system; as a library primarily for close-to-Earth spacecraft, it would presumably be of limited use to support these coordinates. (I couldn't find any references to your <code>getGalactic()</code> method in the Orekit docs or with a Google search of the site).</p>
<p>I have very little familiarity with Java and zero with Orekit but I <em>think</em> you could perform this using by constructing a <code>Transform</code> (<a href="https://www.orekit.org/site-orekit-11.3.3/apidocs/org/orekit/frames/Transform.html" rel="nofollow noreferrer">API docs</a>) and feeding it a <code>Rotation</code> constructed from a 3x3 rotation matrix which is <a href="https://www.hipparchus.org/apidocs/org/hipparchus/geometry/euclidean/threed/Rotation.html#Rotation-double:A:A-double-" rel="nofollow noreferrer">documented here</a>. The rotation matrix to transform ICRS coordinates (which are supported by Orekit) to Galactic coordinates are given in the C source code for the <a href="https://www.iausofa.org" rel="nofollow noreferrer">SOFA</a> routine <a href="http://www.iausofa.org/2021_0512_C/sofa/icrs2g.c" rel="nofollow noreferrer">iauIcrs2g</a>. I have cut and pasted these into the &quot;Java like&quot; code below based on the Orekit API docs but have not tested it any way.</p>
<pre><code>double galrotm[3][3] = { { -0.054875560416215368492398900454,
                           -0.873437090234885048760383168409,
                           -0.483835015548713226831774175116 },
                         { +0.494109427875583673525222371358,
                           -0.444829629960011178146614061616,
                           +0.746982244497218890527388004556 },
                         { -0.867666149019004701181616534570,
                           -0.198076373431201528180486091412,
                           +0.455983776175066922272100478348 } };
Rotation rotation = new Rotation(galrotm, threshold);
Vector3D rotationRate = new Vector3D(0, 0, 0);

Transform ICRStoGal = new Transform(rotation, rotationRate);
</code></pre>
<p>HEASARC has a <a href="https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/convcoord/convcoord.pl" rel="nofollow noreferrer">converter</a> that can take either object names or coordinates and convert them to galactic and ecliptic coordinates; an example for the high mass X-ray/black hole binary Cyg X-1 is shown in the screenshot below (values under the Galactic L and B headings):</p>
<p><a href="https://i.sstatic.net/5BfpV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/5BfpV.png" alt="Screenshot of the HEASARC tool showing an example of how to convert to galactic coordinates" /></a></p>

CC BY-SA 4.0
2023-09-08T23:58:24.743Z
2023-09-08T23:58:24.743Z
astrosnapper
<p>I started using OreKit in a 3D star charting app I am writing in JavaFX. I wanted to convert from equatorial to galactic coordinates.
I can do it simply by using the transformations, but I wanted to use Orekit, so I'm not writing code when a library will do.
The docs in Orekit aren't very good, so I did a search and found this:</p>
<pre><code>   Frame icrf = FramesFactory.getICRF();
   Frame galactic = FramesFactory.getGalactic();
   ... more code
</code></pre>
<p>Frame galactic = FramesFactory.getGalactic(); doesn't seem to exist anymore in Orekit, and I can't seem to find what replaces it.</p>
<p>Anyone know?</p>

<coordinate-systems>
Orekit converting to galactic coordinates
EvilJinious1
# Orekit converting to galactic coordinates

(Asked by: username_0 on 2023-09-08)

I started using OreKit in a 3D star charting app I am writing in JavaFX. I wanted to convert from equatorial to galactic coordinates.
I can do it simply by using the transformations, but I wanted to use Orekit, so I'm not writing code when a library will do.
The docs in Orekit aren't very good, so I did a search and found this:
   Frame icrf = FramesFactory.getICRF();
   Frame galactic = FramesFactory.getGalactic();
   ... more code

Frame galactic = FramesFactory.getGalactic(); doesn't seem to exist anymore in Orekit, and I can't seem to find what replaces it.
Anyone know?

**Tags:** coordinate-systems


---

## 1 answers

### Answer by username_1 on 2023-09-08. Score: 3

I'm not sure Orekit can handle the Galactic coordinate system; as a library primarily for close-to-Earth spacecraft, it would presumably be of limited use to support these coordinates. (I couldn't find any references to your getGalactic() method in the Orekit docs or with a Google search of the site).
I have very little familiarity with Java and zero with Orekit but I think you could perform this using by constructing a Transform (API docs) and feeding it a Rotation constructed from a 3x3 rotation matrix which is documented here. The rotation matrix to transform ICRS coordinates (which are supported by Orekit) to Galactic coordinates are given in the C source code for the SOFA routine iauIcrs2g. I have cut and pasted these into the "Java like" code below based on the Orekit API docs but have not tested it any way.
double galrotm[3][3] = { { -0.054875560416215368492398900454,
                           -0.873437090234885048760383168409,
                           -0.483835015548713226831774175116 },
                         { +0.494109427875583673525222371358,
                           -0.444829629960011178146614061616,
                           +0.746982244497218890527388004556 },
                         { -0.867666149019004701181616534570,
                           -0.198076373431201528180486091412,
                           +0.455983776175066922272100478348 } };
Rotation rotation = new Rotation(galrotm, threshold);
Vector3D rotationRate = new Vector3D(0, 0, 0);

Transform ICRStoGal = new Transform(rotation, rotationRate);

HEASARC has a converter that can take either object names or coordinates and convert them to galactic and ecliptic coordinates; an example for the high mass X-ray/black hole binary Cyg X-1 is shown in the screenshot below (values under the Galactic L and B headings):


---

