# Conversion of Moon's Celestial Position (RA and dec) to Horizontal Coordinates [closed]

I'm currently attempting to calculate the equatorial sky position of the Moon for any given Geostatic position (longitude / latitude) for any given datetime.

I have tested my altitude and azimuth calculations for the major start Betelgeuse. The altitude and azimuth provided match within an accuracy of 0.6 degrees to this online tool: https://eco.mtk.nao.ac.jp/cgi-bin/koyomi/cande/horizontal_rhip_en.cgi

My programming test (written in the Javascript testing framework "JEST") is as follows:

test('convertCelestialCoordinatesToEquatorial', function() {
// Let's find where Betelgeuse will be on the datetime above:
let { alt, az } = celestia.convertCelestialCoordinatesToEquatorial(
betelgeuse,
datetime
)

expect(alt).toBeCloseTo(72.78539444063765, 1)
expect(az).toBeCloseTo(134.44877920325155, 1)
})


So, I'm confident my calcualtions for converting between celestial coordinates and equatorai coordinates are correct, for the Moon's RA and dec are correct (my calculations are correct with three different online widgets to a good level of precision).

However, when I convert the RA and dec of the Moon I know to be correct, through the equatorial conversion function I also know to be correct for distance stellar objects, I get an incorrect value for the altitude and azimuth of the Moon.

This leads me to assume that the equatorial conversion for distant objects can not apply to the Moon, due to various effects that haven't been factored in...

So my question:

Does anyone know the calculation to convert between RA and dec for solar system objects?

• How large was the difference between computed and expected positions for the Moon? Jun 9 '21 at 15:10
• Can you indicate what values your program calculated for all of the items? A difference of 0.6 degrees is large if your input is the same as the reference website. Also, was the input the same? In particular, is the RA and Dec of Betelgeuse the same? Jun 13 '21 at 3:38

It looks like your question will be closed since you haven't responded to the comments asking for additional information yet, so I'll leave a partial answer. I can update this once you respond to the comments asking for details.

Parallax

The Moon will appear at different RA/Dec at the same time but from different places on the Earth's surface. It's possible the numbers you are comparing to for the Moon are computed for the center of the Earth.

### How big can the effect be?

The Earth's equatorial diameter is 12756 km. Let's view the Moon from two places on Earth that are separated by only 10,000 km so that the Moon is well above the horizon from both cases. It might be a full moon an hour after rising at one place in the evening while an hour before setting in the morning in another, but still dark in both places.

The distance to the Moon is on average about 384,000 km. That means the Moon's apparent position will vary by about +/-0.75° compared to a general value calculated for the geocenter.

There's no difference in the calculations, but the Moon, Sun, planets don't have more or less fixed right ascensions and declinations like all the stars. The site you linked seems to only work for stars. Where are you getting ephemerides for non-stars?

• I'm calculating them for the Moon from a known algorithm ... Jun 9 '21 at 13:30
• There is a difference for the Moon. The geocentric RA and Dec that are calculated need tobe converted to topocentric RA and Dec. That can lead to a difference of about 1 degree. Jun 11 '21 at 11:51
• @JohnHoltz You're saying OP's calculation is missing a parallax correction. 0.6 degrees was acceptable for Betellgeuse. The horizontal parallax of 1 degree for the Moon isn't that much more, and is a true worst-case. Jun 11 '21 at 15:45
• @stretch. To clarify, you said there "is no difference in the calculation" for the Moon compared to a star. I am saying that there is a difference. Most algorithms calculate the geocentric coordinates of the Moon. The geocentric RA and Dec need to be converted to topocentric RA and Dec in order to calculate accurate altitude and azimuth. I do agree with you that the 0.6 degree difference for Betelgeuse is large. A similar "error" could explain the difference that was obtained for the Moon. We need more information from the OP to figure out the problem. Jun 13 '21 at 3:40