0.0.6 • Published 4 months ago

sun-position v0.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

sun-position-logo

Status: Development ⚠️

Calculate the position of the sun for a specific date, time and location. Calculate sunrise and sunset

Sun Position is a library under the ISC license. It aims to calculate and obtain the position of the sun for a location defined by geographic coordinates and a specific time.

The results of the lib returns can be checked at the following site.

Developed by @fwerley 👨🏽‍💻


Installation and use

npm i sun-position
import SunPosition from 'sun-postion';
const sunPosition = SunPosition;
const coords = {
    lat: -4.56454,
    lng: -38.9172
}

//Coordinate entry
sunPosition.setLatitude(coords.lat);
sunPosition.setLongitude(coords.lng);

// June 22, 2023, at 5 pm, 52 minutes and 3 seconds
const date = new Date(2023, 5, 22, 17, 52, 3);

// Date-time object input
sunPosition.setDateTime(date);

// Capturing feedback from the Sun's elevation angle and azimuth
let elevation = await sunPosition.getElevation();
let azimuth = await sunPosition.getAzimuth();

References

Input Functions
Return functions

Change history

  • Addition of the equation of time for hourly correction
0.0.6 - December 24, 2023

  • Sunrise and sunset correction
0.0.5 - December 24, 2023

  • Public version on npm
0.0.4 - December 10, 2023
0.0.6

4 months ago

0.0.5

5 months ago

0.0.4

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago