<p>It depends from which celestial coordinates you are converting. I suppose you are working in equatorial coordinates. Then, you can convert as following:</p>

<p>$$\tan A = {\sin h \over \cos h \sin\phi_o - \tan\delta \cos\phi_o} $$ $$ \begin{cases}
 \cos a \sin A = \cos\delta \sin h \\
 \cos a \cos A =  \cos\delta \cos h \sin\phi_o - \sin\delta \cos\phi_o
\end{cases}$$ $$\sin a = \sin\phi_o \sin\delta + \cos\phi_o \cos\delta \cos h$$</p>

<p>Where $A$ is azimuth, $a$ altitude, $\alpha$ right ascension, $\delta$ declination, $h$ hour angle and $\phi_0$ the observer's latitude.</p>

<p>Source: <a href="http://en.wikipedia.org/wiki/Celestial_coordinate_system#Equatorial_.E2.86.90.E2.86.92_horizontal" rel="nofollow">Wikipedia</a></p>

CC BY-SA 3.0
2016-01-04T15:07:54.157Z
Yes, that is the formula that I am using.
VansFannel
CC BY-SA 3.0
2016-01-04T14:23:41.270Z
2016-01-04T14:23:41.270Z
Javier
<p>I'm developing my own Planetarium software using C++ following the book <a href="http://rads.stackoverflow.com/amzn/click/B010WFOATY" rel="nofollow">Practical Astronomy with your Calculator or Spreadsheet 4th Edition</a>.</p>

<p>I don't know if I my formulas are correct or not, but when I check my results (Azimuth and Altitude) with Stellarium, they are different.</p>

<p>I have also checked my values with this <a href="http://www.stargazing.net/mas/al_az.htm" rel="nofollow">page</a>, but they are different. By the way, the azimuth and altitude given in that page are also different from the values given in Stellarium.</p>

<p>Do you know where can I find the formulas to covert celestial coordinate to horizontal coordinates?</p>

CC BY-SA 3.0
2016-01-05T07:07:30.477Z
Yes, I'm using radians. And no, you can't see my source code. There are a lot of classes.
VansFannel
CC BY-SA 3.0
2016-01-05T14:37:04.717Z
Did you verified your results other sources, and also cross-checked the same for stellarium?  Maybe your reference frame is different.
Astroynamicist
<star><coordinate>
Conversion from Equatorial Coordinate to Horizon Coordinates
VansFannel
# Conversion from Equatorial Coordinate to Horizon Coordinates

(Asked by: username_0 on 2016-01-04)

I'm developing my own Planetarium software using C++ following the book [Practical Astronomy with your Calculator or Spreadsheet 4th Edition](http://rads.stackoverflow.com/amzn/click/B010WFOATY).

I don't know if I my formulas are correct or not, but when I check my results (Azimuth and Altitude) with Stellarium, they are different.

I have also checked my values with this [page](http://www.stargazing.net/mas/al_az.htm), but they are different. By the way, the azimuth and altitude given in that page are also different from the values given in Stellarium.

Do you know where can I find the formulas to covert celestial coordinate to horizontal coordinates?

**Tags:** star, coordinate

> **Comments:**
> **username_0**: Yes, I'm using radians. And no, you can't see my source code. There are a lot of classes.  
> **username_1**: Did you verified your results other sources, and also cross-checked the same for stellarium?  Maybe your reference frame is different.  

---

## 1 answers

### Answer by username_2 on 2016-01-04. Score: 3 | Accepted answer

It depends from which celestial coordinates you are converting. I suppose you are working in equatorial coordinates. Then, you can convert as following:

$$\tan A = {\sin h \over \cos h \sin\phi\_o - \tan\delta \cos\phi\_o} $$ $$ \begin{cases}
\cos a \sin A = \cos\delta \sin h \\
\cos a \cos A = \cos\delta \cos h \sin\phi\_o - \sin\delta \cos\phi\_o
\end{cases}$$ $$\sin a = \sin\phi\_o \sin\delta + \cos\phi\_o \cos\delta \cos h$$

Where $A$ is azimuth, $a$ altitude, $\alpha$ right ascension, $\delta$ declination, $h$ hour angle and $\phi\_0$ the observer's latitude.

Source: [Wikipedia](http://en.wikipedia.org/wiki/Celestial_coordinate_system#Equatorial_.E2.86.90.E2.86.92_horizontal)

> **Comments:**
> **username_0**: Yes, that is the formula that I am using.  

---

