Can now calculate the heliocentric Solar System Barycenter (SSB) and Earth/Moon Barycenter (EMB). Changes made in C, C#, JavaScript and Python: Added new body codes SSB, EMB. Added support for calculating both in HelioVector functions. Verified that all calculations match NOVAS. Verified that all calculations match each other across languages.
JavaScript examples for Node.js
The source file
astronomy.js
works as a Node.js module. Download the file into your project directory.
Then in your own source file, do this:
const Astronomy = require('astronomy.js');
There are no external dependencies!
Astronomy Engine is completely self-contained, and it always will be.
(By the way, you can use the same file astronomy.js for
astronomy calculations inside the browser.)
Moon Phase Calculator
This example shows how to determine the Moon's current phase, and how to predict when the next few quarter phases will occur.
Planet Positions
Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets.
Rise/Set
Shows how to calculate sunrise, sunset, moonrise, and moonset times.
Seasons
Calculates the equinoxes and solstices for a given calendar year.
Culmination
Finds when the Sun, Moon, and planets reach their highest position in the sky on a given date, as seen by an observer at a specified location on the Earth. Culmination is also the moment a body crosses the meridian, the imaginary semicircle in the sky that passes from due north on the horizon, through the zenith (straight up), and then toward due south on the horizon.
Horizon Intersection
This is a more advanced example. It shows how to use coordinate transforms to find where the ecliptic intersects with an observer's horizon at a given date and time.
API Reference
Complete documentation for all the functions and types available in the JavaScript version of Astronomy Engine.