<p>You can't without knowing the distance to the star, <span class="math-container">$d$</span>.</p>
<p>Once you have that then, depending on exactly how the <span class="math-container">$x, y, z$</span> axes are defined:
<span class="math-container">$$
\begin{align}
x &amp;= d \cos(b)\cos(l) \\
y &amp;= d \cos(b) \sin(l) \\
z &amp;= d \sin(b)\ ,
\end{align}
$$</span>
where I have used a usual convention that <span class="math-container">$x$</span> is measured towards the Galactic centre from Earth, <span class="math-container">$y$</span> is measured at right angles to this but in the Galactic plane and <span class="math-container">$z$</span> is perpendicular to the Galactic plane.</p>
<p>If you wish to have the origin at the Galactic centre then simply subtract the <span class="math-container">$x$</span> coordinate of the Galactic centre from <span class="math-container">$x$</span>.</p>
<p>Where might you find those distances? Well, the reciprocal of the parallax in the Hipparcos catalogue gives you an estimate of the distance. It isn't very precise or accurate for many stars though. A better source of parallax data would come from a cross-match with the <a href="https://www.cosmos.esa.int/web/gaia/dr3" rel="nofollow noreferrer">Gaia DR3 catalogue</a>. The parallaxes can be transformed to a distance (an approach to this is provided by the catalogue of <a href="https://cdsarc.cds.unistra.fr/viz-bin/cat/I/35" rel="nofollow noreferrer">Bailer-Jones 2021</a>).</p>

CC BY-SA 4.0
2023-03-28T06:20:41.603Z
2024-10-09T12:05:47.330Z
2024-10-09T12:05:47.330Z
ProfRob
<p>I'm using the <a href="https://en.wikipedia.org/wiki/Galactic_coordinate_system" rel="nofollow noreferrer">Galactic Coordinates</a> to draw stars (from the Hipparcos catalogue) in a 3D space, but I don't know how to do it.</p>
<p>In the book &quot;<a href="https://rads.stackoverflow.com/amzn/click/com/1108436072" rel="nofollow noreferrer" rel="nofollow noreferrer">Practical Astronomy with your Calculator or Spreadsheet</a>&quot; I've found this:</p>
<p><a href="https://i.sstatic.net/kWQgU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kWQgU.png" alt="enter image description here" /></a></p>
<p>Where:<br/>
<em><strong>S</strong></em>: the Sun.<br/>
<em><strong>G</strong></em>: the centre of the Galaxy.<br/>
<em><strong>X</strong></em>: a star which not lie in the galactic plane.<br/>
<em><strong>l</strong></em>: galactic longitude.<br/>
<em><strong>b</strong></em>: galactic latitude.<br/></p>
<p>If I know <strong>S</strong>, <strong>G</strong>, <strong>l</strong> and <strong>b</strong>. How can I know the <em>(x, y, z)</em> coordinates of the star <strong>X</strong>?</p>
<p>Probably I need to know the distance between <strong>S</strong> and <strong>X</strong>.</p>

CC BY-SA 4.0
2023-03-27T02:43:33.503Z
Yes, you will indeed need to know the distance between S and X. Multiple star catalogues are available on the Internet which can provide you with this information. Keep in mind, though, that astronomical distances can only be measured indirectly, and there is an error margin to the measurement, so you may get slightly different values in different catalogues.
Pierre Paquette
CC BY-SA 4.0
2023-03-27T05:08:32.617Z
You can use the "parallax" field of a star catalog, and the RA/Dec to compute the XYZ coordinates relative to the Solar System Barycenter.  Example is here: https://www.celestialprogramming.com/snippets/starxyz.html  .  Then shift the results so the galactic center is 0,0,0.
Greg Miller
CC BY-SA 4.0
2023-03-27T07:06:55.313Z
@GregMiller Thanks for you comment. Now, I'm using Hipparcos Catalogue, but I've been checking the Gaia project to look for a field called "distance".
VansFannel
<distances><coordinate><galactic-center>
Drawing stars in a 3D space
VansFannel
# Drawing stars in a 3D space

(Asked by: username_0 on 2023-03-26)

I'm using the [Galactic Coordinates](https://en.wikipedia.org/wiki/Galactic_coordinate_system) to draw stars (from the Hipparcos catalogue) in a 3D space, but I don't know how to do it.

In the book "[Practical Astronomy with your Calculator or Spreadsheet](https://rads.stackoverflow.com/amzn/click/com/1108436072)" I've found this:

[![enter image description here](https://i.sstatic.net/kWQgU.png)](https://i.sstatic.net/kWQgU.png)

Where:  
***S***: the Sun.  
***G***: the centre of the Galaxy.  
***X***: a star which not lie in the galactic plane.  
***l***: galactic longitude.  
***b***: galactic latitude.

If I know **S**, **G**, **l** and **b**. How can I know the *(x, y, z)* coordinates of the star **X**?

Probably I need to know the distance between **S** and **X**.

**Tags:** distances, coordinate, galactic-center

> **Comments:**
> **username_1**: Yes, you will indeed need to know the distance between S and X. Multiple star catalogues are available on the Internet which can provide you with this information. Keep in mind, though, that astronomical distances can only be measured indirectly, and there is an error margin to the measurement, so you may get slightly different values in different catalogues.  
> **username_2**: You can use the "parallax" field of a star catalog, and the RA/Dec to compute the XYZ coordinates relative to the Solar System Barycenter.  Example is here: https://www.celestialprogramming.com/snippets/starxyz.html  .  Then shift the results so the galactic center is 0,0,0.  
> **username_0**: @username_2 Thanks for you comment. Now, I'm using Hipparcos Catalogue, but I've been checking the Gaia project to look for a field called "distance".  

---

## 1 answers

### Answer by username_3 on 2023-03-28. Score: 5 | Accepted answer

You can't without knowing the distance to the star, $d$.

Once you have that then, depending on exactly how the $x, y, z$ axes are defined:
$$
\begin{align}
x &= d \cos(b)\cos(l) \\
y &= d \cos(b) \sin(l) \\
z &= d \sin(b)\ ,
\end{align}
$$
where I have used a usual convention that $x$ is measured towards the Galactic centre from Earth, $y$ is measured at right angles to this but in the Galactic plane and $z$ is perpendicular to the Galactic plane.

If you wish to have the origin at the Galactic centre then simply subtract the $x$ coordinate of the Galactic centre from $x$.

Where might you find those distances? Well, the reciprocal of the parallax in the Hipparcos catalogue gives you an estimate of the distance. It isn't very precise or accurate for many stars though. A better source of parallax data would come from a cross-match with the [Gaia DR3 catalogue](https://www.cosmos.esa.int/web/gaia/dr3). The parallaxes can be transformed to a distance (an approach to this is provided by the catalogue of [Bailer-Jones 2021](https://cdsarc.cds.unistra.fr/viz-bin/cat/I/35)).


---

