astronomy-js

AstronomyJS

Build Status Coverage Status

Astronomical calculations in JavaScript.


🚀 See It in Action!

These tiles were generated using the astronomy-svg library.

👉 Check out the live demo here

View Demo


📖 API Reference

AstronomyJS

The main class to interact with the library.

Static Methods

Instance Methods

🪐 Supported Objects and Ephemeris Types

The library includes data for major solar system bodies and various ephemeris events.

Common Objects

Ephemeris Types

Use these names with getEphemerisDateForObject:


🪐 Supported Calculations

Quickstart

🌐 Using the Browser-Ready Minified Script

<script type="text/javascript" src="astronomy-js.min.js"></script>
// latitude, longitude
let astronomyJS = AstronomyJS.initialize(56.2, 18.1)
astronomyJS.getAltitudeAzimuthCoordinatesForObject("Sun");

🌟 Installation (npm)

npm install astronomy-js

Using the JavaScript ES Module

import { AstronomyJS } from "astronomy-js";
// latitude, longitude
let astronomyJS = AstronomyJS.initialize(56.2, 18.1)
astronomyJS.getAltitudeAzimuthCoordinatesForObject("Sun");

📄 License

This project is licensed under the MIT License — feel free to use, modify, and share it.
Please make sure to retain the original license and attribution when reusing or modifying the code.
See the LICENSE file for full details.

🌌 About

This library provides astronomical calculations for leisure purposes only. Some important basic aspects are not implemented, such as:

View Demo

📚 References

US Naval Observatory, Explanatory Supplement to the Astronomical Almanac, 1992