-
IMPORTANT NOTE:
Some of the demonstration programs below may take several seconds to be computed since some of them are for multiple bodies. Please be patient during the computations. However, since the source code is freely available, if you are a PHP programmer, you can edit the programs to your own custom specifications.
-
When planning on viewing the moon, planets or asteroids, one of the first things we need to know is when the objects of interest will be above the horizon at our location. This means we need to know when the objects rise, transit and set. These values give us an idea as to when to best view the objects. The rising, transit and setting times tell us the time period in which an object may possibly be visible, given local terrain and weather being favorable.
-
At transit, an astronomical object is crossing the celestial meridian at its highest point in the sky between rising and setting.
-
The NASA/JPL Horizons API can compute a table of rising, transit and setting times for essentially any body for which an apparent topocentric ephemeris can be made. But the computations returned by Horizons can sometimes be very large and very hard to print for some users. However, the Horizons table format problem can be overcome by writing your own software to reconstruct the Horizons tables in a more customized and convenient format, as will be subsequently demonstrated below.
-
The rising, transit and setting times tabulated below are computed from local apparent topocentric coordinates with standard atmospheric refraction applied.
-
Here is an API computed example for the moon spanning the first 15 days of January of 2026. (Opens in a New Tab).
Raw Moonrise / Transit / Moonset Times Demo
This demo shows what a returned raw RTS epehemeris table looks like before parsing and reconstructing its ephemeris content into a customized and more compact tabular format as demonstrated in the demos below.
-
As one can see from observing the above raw demo RTS table, it would be a bit cumbersome to print out such a table on a typical home PC printer. Generally, we don't really need all the extraneous text that comes with every table, so we only extract keep the tabular data for later parsing and reformatting as per convenience.
-
That's the beauty of the Horizons API. We can perform countless astronomical computations with it and then reformat the returned results to our custom requirements.
Here is an example for the rising, transit and setting time of the Sun and Moon, all in one. (Opens in a New Tab). It may take several seconds to run this demo.
Sun and Moon Rising, Transit and Setting Times Demo
-
Here is an example for 3 major asteroids all in one. (Opens in a New Tab).
It may also take several seconds to run this demo.
Asteroids Ceres, Vesta and Hebe Rising, Transit and Setting Times Demo
-
The above Sun, Moon, planets and asteroids demos show only a few mere samples of what PHP can do using the Horizons API in the background. In effect, it allows you to create your own customized astronomical ephemerides (almanacs) on demand for virtually any of the countless thousands of astronomical bodies in the NASA/JPL Horizons solar system database.
-
Since all of the programs are freely provided with ready-to-run public domain source code, programmers are free to modify the PHP code in any way they wish.
|