Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.33 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.33 KB

suncalc

This is a very reduced version of Vladimir Agafonkin's SunCalc library (https://github.com/mourner/suncalc).

A clone for shadow calculation of OSM Buildings. Contains code from getPosition() only.

--

SunCalc is a tiny BSD-licensed JavaScript library for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position and lunar phase for the given location and time, created by Vladimir Agafonkin (@mourner) as a part of the SunCalc.net project.

Most calculations are based on the formulas given in the excellent Astronomy Answers articles about position of the sun and the planets. You can read about different twilight phases calculated by SunCalc in the Twilight article on Wikipedia.

Usage

suncalc(timeAndDate, latitude, longitude)

Returns an object with the following properties:

  • altitude: sun altitude above the horizon in radians, e.g. 0 at the horizon and PI/2 at the zenith (straight over your head)
  • azimuth: sun azimuth in radians (direction along the horizon, measured from south to west), e.g. 0 is south and Math.PI * 3/4 is northwest