IRI.Maptor.Core.Astronomy
4.0.0-alpha
See the version list below for details.
dotnet add package IRI.Maptor.Core.Astronomy --version 4.0.0-alpha
NuGet\Install-Package IRI.Maptor.Core.Astronomy -Version 4.0.0-alpha
<PackageReference Include="IRI.Maptor.Core.Astronomy" Version="4.0.0-alpha" />
<PackageVersion Include="IRI.Maptor.Core.Astronomy" Version="4.0.0-alpha" />
<PackageReference Include="IRI.Maptor.Core.Astronomy" />
paket add IRI.Maptor.Core.Astronomy --version 4.0.0-alpha
#r "nuget: IRI.Maptor.Core.Astronomy, 4.0.0-alpha"
#:package IRI.Maptor.Core.Astronomy@4.0.0-alpha
#addin nuget:?package=IRI.Maptor.Core.Astronomy&version=4.0.0-alpha&prerelease
#tool nuget:?package=IRI.Maptor.Core.Astronomy&version=4.0.0-alpha&prerelease
IRI.Maptor.Core.Astronomy
Positional astronomy for maps: astronomical time scales, sidereal time, the Sun's position, and sunrise, sunset, solar noon and twilight at any place and date. Written from scratch in managed C# with no third-party dependencies; it works fully offline.
Usage
using IRI.Maptor.Core.Astronomy.Solar;
using IRI.Maptor.Core.Common.Primitives;
var tehran = new Point(51.3890, 35.6892); // X = longitude, Y = latitude, degrees
var day = Sun.GetSolarDay(tehran, new DateTime(2026, 6, 21), TimeSpan.FromHours(3.5));
Console.WriteLine($"Sunrise {day.Sunrise:HH:mm} noon {day.SolarNoon:HH:mm} sunset {day.Sunset:HH:mm}");
Console.WriteLine($"Civil twilight {day.CivilTwilight.Rising:HH:mm}–{day.CivilTwilight.Setting:HH:mm}, day length {day.DayLength}");
var now = DateTime.UtcNow;
var sky = Sun.GetHorizontal(tehran, now); // azimuth from north, geometric elevation
var subSolar = Sun.GetSubSolarPoint(now); // where the Sun is at the zenith
Sunis the entry point:GetPosition(utc)→SunPosition: apparent ecliptic longitude, right ascension, declination, distance, equation of time, sub-solar point.GetHorizontal(location, utc)→HorizontalCoordinate: azimuth (from north, clockwise) and geometric elevation (no refraction).GetSolarDay(location, date, utcOffset | timeZone)→SolarDay: solar noon and its elevation, sunrise/sunset and their azimuths, civil/nautical/astronomical twilight, day length, polar day/night.GetAltitudeEvents(location, date, utcOffset, altitude): when the Sun crosses any elevation, for custom twilight definitions.GetPhase(location, utc)→SolarPhase: day, civil, nautical or astronomical twilight, or night.SolarPhases.FromElevationgives the same for an elevation.
SolarDayis the solar day whose noon falls on the requested local date. Its sunrise is the one before that noon and its sunset the one after. All times areDateTimeOffsets in the requested offset.- Missing events are
null, never NaN.IsPolarDay/IsPolarNight(andAltitudeEvents.IsAlwaysAbove/IsAlwaysBelowfor each twilight) say why. SunAltitudesholds the standard elevations: −0.8333° (sunrise/sunset), −6°, −12°, −18°.Time/:AstroTime: Julian date, Julian Ephemeris Day (TT), ΔT, Julian centuries.SiderealTime: Greenwich mean/apparent and local apparent sidereal time, in degrees.
Coordinates/:EquatorialCoordinate,HorizontalCoordinate, andObserver.ToHorizontal/GetHourAnglefor any body.Events/CrossingSolver: bisection for the instant a time-dependent value crosses a threshold.
Conventions
- Angles are degrees; locations are geographic
Points (X = longitude east-positive, Y = latitude). DateTimeinputs are UTC;Unspecifiedis taken as UTC andLocalis converted.- UT1 is approximated by UTC (they differ by less than 0.9 s).
Accuracy
- The Sun uses the low-precision theory from Meeus, Astronomical Algorithms, ch. 25, the same theory as NOAA's solar calculator. That is about 0.01° in position.
- Nutation is a four-term series, good to about 0.5″.
- Rise/set times are solved to 1 s. They agree with the U.S. Naval Observatory to within its minute rounding, including at polar latitudes. The unpredictable part is the atmosphere: real refraction near the horizon varies by minutes.
- ΔT uses the Espenak–Meeus polynomials, so years after 2025 are an extrapolation. This shifts the Sun by well under 0.001°.
Tests: tests/IRI.Maptor.Tests/Astronomy (Meeus worked examples 7.a, 12.a/b, 25.a, 28.b; USNO times for Tehran, Sydney and Tromsø).
Room to grow
The project is meant to hold the rest of positional astronomy as it is needed:
- The Moon: position, phase, illumination, moonrise/moonset.
- Planets (truncated VSOP87) and a bright-star catalogue.
- Solar and lunar eclipses.
- Prayer times, which are sun-elevation events (
GetAltitudeEvents) plus the Asr shadow rule. - Shadow length and direction, and solar-panel angles.
IRI.Maptor.Core.Satellite builds on this project for sidereal time and the Sun.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- IRI.Maptor.Core.Common (>= 4.0.0-alpha)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on IRI.Maptor.Core.Astronomy:
| Package | Downloads |
|---|---|
|
IRI.Maptor.Core.Persistence
A .NET standard library containing primitive types to work with persistence layers |
|
|
IRI.Maptor.Core.Satellite
A .NET standard library for satellite orbits: TLE and OMM reading, SGP4 propagation and the satellite's position over the Earth |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1 | 230 | 12/1/2026 |
| 4.0.1-alpha | 207 | 12/1/2026 |
| 4.0.0 | 222 | 12/1/2026 |
| 4.0.0-alpha | 211 | 12/1/2026 |
| 3.0.0 | 141 | 11/10/2026 |
| 3.0.0-alpha | 140 | 10/29/2026 |