<p>Assuming negative longitude in WGS84 is west of Greenwich than you would get LONGITUDE = RA*15 and LATITUDE = DEC. The celestial longitude RA=0 through the vernal equinox would then be projected on the meridian of Greenwich.</p>

<p>If you subtract 180 from the LONGITUDE then you would just rotate the celestial sphere by 180°. The meridian of Greenwich would then equate to RA=12h.</p>

<p>If you want the stars to move with the rotation of the Earth, then you would use LONGITUDE = RA*15 - THETA*15, where THETA is the <a href="http://en.wikipedia.org/wiki/Sidereal_time" rel="nofollow">sidereal time</a> at Greenwich in decimal hours.</p>

<p>You should be aware that for the celestial sphere you look from the centre towards the inside of the surface of the sphere, while for geographical purposes you look from the outside (above) towards the spheroid (down). So if you project the stars on a globe like this, you will notice that the constellations will look inverted from what you're used to in star maps. If you find one of those old celestial globes, you will also see the inverted constellations. For instance on <a href="http://www.mhs.ox.ac.uk/wp-content/uploads/17.-Mercator-globe1.jpg" rel="nofollow">this image</a>, you'll see Leo to the left of Virgo and Hercules, while on most star maps, Leo will be to the right.</p>

<p>If you want the constellations to look 'right' then you would need to use LONGITUDE = -RA*15 (mind the minus sign). But then you would also need to invert the rotation of the Earth as well. </p>

CC BY-SA 3.0
2014-01-29T22:18:46.373Z
2014-01-29T22:42:39.893Z
2014-01-29T22:42:39.893Z
Dieudonné
<p>I've imported the HYG Database from <a href="http://www.astronexus.com/node/34" rel="nofollow noreferrer">http://www.astronexus.com/node/34</a> and now I need to convert all RA/dec stars positions to fit in a WGS 84 coordinates (SRID=4326) PostGIS map (-180 to 180, 90 to -90).</p>

<pre><code>BayerFlamsteed  ProperName  RA            DEC
21Alp And       Alpheratz   0.13976888    29.09082805
11Bet Cas       Caph        0.15280269    59.15021814
88Gam Peg       Algenib     0.22059721    15.18361593
Alp Phe         Ankaa       0.43801871    -42.30512197
18Alp Cas       Shedir      0.67510756    56.53740928
16Bet Cet       Diphda      0.7264523     -17.98668410
</code></pre>

<p>Related to:</p>

<p><a href="https://gis.stackexchange.com/questions/84389/spatial-database-containing-coordinates-for-stars-in-the-sky">https://gis.stackexchange.com/questions/84389/spatial-database-containing-coordinates-for-stars-in-the-sky</a></p>

<p><a href="https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor">https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor</a></p>

<p><strong>EDIT: Ok, I think MerseyViking gives the answer in <a href="https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor">https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor</a> telling to create a new coordinate system. Can someone give a look and some opinion?</strong></p>

<p>EDIT 2 (After answered): Fantastic!! I need to show the results of whuber and Dieudonné's answer. The first picture I show the query in QGIS. In second picture you can see the real positions in a map. The scale is different - Find Shaula, Nunki and Antares.</p>

<p>This is the conversion method ('H' is for Hyparcus in my database):</p>

<pre><code>insert into stars 
    select 
        id, 
        proper_name, 
        ST_SetSRID(ST_MakePoint( (-ra * 15), dec),4326),
        mag,
        'H'
    from hygn
    where (proper_name is not null)
</code></pre>

<p><img src="https://i.sstatic.net/HgQrA.png" alt="My qgis query"></p>

<p><img src="https://i.sstatic.net/fT5SP.png" alt="A real map"></p>

CC BY-SA 3.0
2014-01-29T21:00:09.533Z
I've never heard of this system. I did a little research on it and it seems that it's mainly used by the Global Positioning System community, which is why an astronomer has never come across it. I would have recommended astropy's coordinates package, however, having already looked to see if it were in there I can tell you you're probably not going to find it (unless it had another alias).
astromax
CC BY-SA 3.0
2014-01-29T21:03:51.547Z
It probably depends on the accuracy you need, but if you map celestial coordinates (with a reference surface that is a sphere) to WGS84 (with a spheroidal reference surface) you will get distortions. What do you want to use it for?
Dieudonné
CC BY-SA 3.0
2014-01-29T21:45:02.953Z
@Dieudonné : Nothing too professional. Small distortions are acceptable. As see in related link, whuber proposes the formula LONGITUDE = (RA*15) - 180 and LATITUDE = DEC. Can someone verify this?
Magno C
<coordinate>
Convert coordinates between RA/dec and WGS 84 (SRID=4326)
Magno C
# Convert coordinates between RA/dec and WGS 84 (SRID=4326)

(Asked by: username_0 on 2014-01-29)

I've imported the HYG Database from <http://www.astronexus.com/node/34> and now I need to convert all RA/dec stars positions to fit in a WGS 84 coordinates (SRID=4326) PostGIS map (-180 to 180, 90 to -90).

```
BayerFlamsteed  ProperName  RA            DEC
21Alp And       Alpheratz   0.13976888    29.09082805
11Bet Cas       Caph        0.15280269    59.15021814
88Gam Peg       Algenib     0.22059721    15.18361593
Alp Phe         Ankaa       0.43801871    -42.30512197
18Alp Cas       Shedir      0.67510756    56.53740928
16Bet Cet       Diphda      0.7264523     -17.98668410

```

Related to:

<https://gis.stackexchange.com/questions/84389/spatial-database-containing-coordinates-for-stars-in-the-sky>

<https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor>

**EDIT: Ok, I think MerseyViking gives the answer in <https://gis.stackexchange.com/questions/2459/what-coordinate-system-should-be-used-to-store-geography-data-for-celestial-coor> telling to create a new coordinate system. Can someone give a look and some opinion?**

EDIT 2 (After answered): Fantastic!! I need to show the results of whuber and username_2's answer. The first picture I show the query in QGIS. In second picture you can see the real positions in a map. The scale is different - Find Shaula, Nunki and Antares.

This is the conversion method ('H' is for Hyparcus in my database):

```
insert into stars 
    select 
        id, 
        proper_name, 
        ST_SetSRID(ST_MakePoint( (-ra * 15), dec),4326),
        mag,
        'H'
    from hygn
    where (proper_name is not null)

```

![My qgis query](https://i.sstatic.net/HgQrA.png)

![A real map](https://i.sstatic.net/fT5SP.png)

**Tags:** coordinate

> **Comments:**
> **username_1**: I've never heard of this system. I did a little research on it and it seems that it's mainly used by the Global Positioning System community, which is why an astronomer has never come across it. I would have recommended astropy's coordinates package, however, having already looked to see if it were in there I can tell you you're probably not going to find it (unless it had another alias).  
> **username_2**: It probably depends on the accuracy you need, but if you map celestial coordinates (with a reference surface that is a sphere) to WGS84 (with a spheroidal reference surface) you will get distortions. What do you want to use it for?  
> **username_0**: @username_2 : Nothing too professional. Small distortions are acceptable. As see in related link, whuber proposes the formula LONGITUDE = (RA*15) - 180 and LATITUDE = DEC. Can someone verify this?  

---

## 1 answers

### Answer by username_2 on 2014-01-29. Score: 3 | Accepted answer

Assuming negative longitude in WGS84 is west of Greenwich than you would get LONGITUDE = RA\*15 and LATITUDE = DEC. The celestial longitude RA=0 through the vernal equinox would then be projected on the meridian of Greenwich.

If you subtract 180 from the LONGITUDE then you would just rotate the celestial sphere by 180°. The meridian of Greenwich would then equate to RA=12h.

If you want the stars to move with the rotation of the Earth, then you would use LONGITUDE = RA\*15 - THETA\*15, where THETA is the [sidereal time](http://en.wikipedia.org/wiki/Sidereal_time) at Greenwich in decimal hours.

You should be aware that for the celestial sphere you look from the centre towards the inside of the surface of the sphere, while for geographical purposes you look from the outside (above) towards the spheroid (down). So if you project the stars on a globe like this, you will notice that the constellations will look inverted from what you're used to in star maps. If you find one of those old celestial globes, you will also see the inverted constellations. For instance on [this image](http://www.mhs.ox.ac.uk/wp-content/uploads/17.-Mercator-globe1.jpg), you'll see Leo to the left of Virgo and Hercules, while on most star maps, Leo will be to the right.

If you want the constellations to look 'right' then you would need to use LONGITUDE = -RA\*15 (mind the minus sign). But then you would also need to invert the rotation of the Earth as well.


---

