calculateSunPosition

fun calculateSunPosition(dateTime: ZonedDateTime, latitude: Double, longitude: Double): SolarPosition

Calculate the sun's position in the sky for a given location and time.

Uses NOAA solar position algorithms (commons-suncalc) which are accurate to within 0.01° when accounting for refraction effects.

Return

SolarPosition containing azimuth (0-360°) and altitude (-90 to +90°)

Parameters

dateTime

The date/time and timezone for the calculation (must be ZonedDateTime to handle DST)

latitude

Latitude in decimal degrees (-90 to +90)

longitude

Longitude in decimal degrees (-180 to +180)

See also