Files
astronomy/demo/nodejs
Don Cross e3255c7401 Cleaned up and unified Earth and Moon radius constants.
In all 4 supported languages, use consistent constant names for
Earth and Moon radii.

Use Moon's equatorial radius for rise/set timing.

Use Moon's mean radius for calculating Moon's umbra radius for
detecting solar eclipses.

Also use Moon's mean radius for determining whether the Earth's shadow
touches the Moon, for finding lunar eclipses.

Use the Moon's polar radius for distinguishing between total
and annular eclipses, with a 14 meter bias (instead of 1420 meters!)
to match Espenak data.

Use consistent unit test error threshold of 0.57 minutes for rise/set.
Updated demo test data for slight changes to rise/set prediction times.

Updated doxygen options to issue an error on any warnings.
Fixed the incorrect function name link that doxygen was warning me about.
2020-05-23 13:08:25 -04:00
..
2020-05-17 14:03:01 -04:00
2019-12-14 21:16:43 -05:00
2020-05-17 14:03:01 -04:00
2020-05-17 14:03:01 -04:00
2020-05-17 14:03:01 -04:00
2020-05-17 14:03:01 -04:00
2019-06-16 21:30:53 -04:00

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');

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


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.

Lunar Eclipse

Calculates details about the first 10 partial/total lunar eclipses after the given date and time.

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.

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.


API Reference

Complete documentation for all the functions and types available in the JavaScript version of Astronomy Engine.