Convert coordinates between RA/dec and WGS 84 (SRID=4326)

  • 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 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.



    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



    A real map


    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).

    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é : 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?

  • Dieudonné

    Dieudonné Correct answer

    8 years ago

    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 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, 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.


License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used