IRI.Maptor.Core.Astronomy 3.0.0-alpha

This is a prerelease version of IRI.Maptor.Core.Astronomy.
There is a newer version of this package available.
See the version list below for details.
dotnet add package IRI.Maptor.Core.Astronomy --version 3.0.0-alpha
                    
NuGet\Install-Package IRI.Maptor.Core.Astronomy -Version 3.0.0-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IRI.Maptor.Core.Astronomy" Version="3.0.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IRI.Maptor.Core.Astronomy" Version="3.0.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="IRI.Maptor.Core.Astronomy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add IRI.Maptor.Core.Astronomy --version 3.0.0-alpha
                    
#r "nuget: IRI.Maptor.Core.Astronomy, 3.0.0-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package IRI.Maptor.Core.Astronomy@3.0.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=IRI.Maptor.Core.Astronomy&version=3.0.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=IRI.Maptor.Core.Astronomy&version=3.0.0-alpha&prerelease
                    
Install as a Cake Tool

IRI.Maptor.Core.Astronomy

Target

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
  • Sun is 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.FromElevation gives the same for an elevation.
  • SolarDay is 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 are DateTimeOffsets in the requested offset.
  • Missing events are null, never NaN. IsPolarDay/IsPolarNight (and AltitudeEvents.IsAlwaysAbove/IsAlwaysBelow for each twilight) say why.
  • SunAltitudes holds 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, and Observer.ToHorizontal/GetHourAngle for 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).
  • DateTime inputs are UTC; Unspecified is taken as UTC and Local is 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 226 12/1/2026
4.0.1-alpha 204 12/1/2026
4.0.0 218 12/1/2026
4.0.0-alpha 205 12/1/2026
3.0.0 140 11/10/2026
3.0.0-alpha 139 10/29/2026