A library designed to ease geographic coordinate format conversions, and determine sun/moon information in C#
-Adds Hours of Day DaySpan
and Hours of Night NightSpan
TimeSpan
properties to the CelestialInfo
class for easier calculation of total day and night hours for a date at a specified location.
Example:
Coordinate c = new Coordinate(-47, -122, new DateTime(2023, 9, 30));
c.Offset = -7;
Console.WriteLine("DAY SPAN: " + c.CelestialInfo.DaySpan.TotalHours); //12.5616666666667
Console.WriteLine("NIGHT SPAN: " + c.CelestialInfo.NightSpan.TotalHours); //11.4383333333333
-Adds .NET 8.0 support.
-Adds magnitude and coverage properties to solar eclipse data.
-Adds umbral and penumbral magnitude properties to lunar eclipse data..
-Removes BinarySerialization from unit tests. Used JSON to store test object for eclipse comparison.
-Adds correctly named PartialEclipseEnd
property to SolarEclipseDetails
and deprecates incorrectly named property.
-Various documentation updates.
//Create a coordinate and specify a date.
Coordinate c = new Coordinate(49, -122, new DateTime(2023, 9, 30));
//Set local UTC offset as desired.
c.Offset = -7;
//Set current sun azimuth in degrees E of N
double az = 120;
//Determine time of day. Default azimuth accuracy error delta is 1 degree by default,
//but it is set at .5 for this example.
DateTime? t = Celestial.Get_Time_At_Solar_Azimuth(az, c, .5);
Console.WriteLine($"{t}"); //9/30/2023 9:21:44 AM
var utm = new UniversalTransverseMercator("Q", 61, 581943.5, 2111989.8);
utm.Out_Of_Bounds; //true. zone 61 is outside of limits
Deprecates 'AstrologicalSigns' class and replaces with new 'AlmanacMoonName' class.
Various documentation fixes.
-Fixes "Leap Year Bug" impacting celestial calculations and Julian date conversions prior to 1582 (pre-Gregorian).
-Exposes the Obliquity of Ecliptic value within the SolarCoordinate
class.
-Improves UTM and MGRS conversion efficiency by 13x. -Adds ability create geofence from a specified GEOREF coordinate and precision level. -Adds ability to locate GEOREF box corners based on a given precision level. -Restricts GEOREF easting and northing minutes and seconds to 59.999... to comply with library standards.
Examples;
int precision = 6;
//Get GeoFence
GEOFENCE fence = georef.ToGeoFence(precision);
//Get Corners
GEOREF bl = georef.Get_BottomLeftCorner(precision);
GEOREF tr = georef.Get_TopRightCorner(precision);
-Adds ability to operate Coordinate objects in the environment's local time by default.
//Set at application startup
GlobalSettings.Allow_Coordinate_DateTimeKind_Specification = true;
//EST Date 21-MAR-2019 @ 07:00 AM Local
DateTime d = new DateTime(2017,3,21,7,0,0);
Coordinate c = new Coordinate(40.57682, -70.75678, d);
.CelestialInfo.SunRise.ToString(); //Outputs 3/21/2017 06:45:00 AM
-Update branding package & license.
Deprecates UTM and MGRS ToCentimeterString()
and replaces with ToRoundedString(int precision)
overload that allows user to specify desired centimeter precision. Closes Issue 208.
Coordinate c = new Coordinate(40.57682, -70.75678);
c.MGRS.ToRoundedString(); // Outputs 19T CE 51308 93265
c.MGRS.ToRoundedString(5); // Outputs 19T CE 51307.55707 93264.83597
Creates Astrological Sign Enumerators and fixes spelling issues. Closes Issue 210 and Issue 211
Add ability to set a default datum other that WGS84 by setting an application wide Equatorial Radius (Semi-Major Axis) and Inverse Flattening value.
GlobalSettings.Set_DefaultDatum(Earth_Ellipsoid_Spec.Airy_1830);
//OR
GlobalSettings.Set_DefaultDatum(Earth_Ellipsoid.Get_Ellipsoid(Earth_Ellipsoid_Spec.Airy_1830));
//OR
GlobalSettings.Default_EquatorialRadius = 6377563.396;
GlobalSettings.Default_InverseFlattening = 299.3249646;
-Adds GEOREF conversions.
Coordinate c = new Coordinate(45, 64);
//Default output set at precision 6
Console.WriteLine(c.GEOREF.ToString()); //SKEA000000000000
//Override output precision via override
Console.WriteLine(c.GEOREF.ToString(2)); //SKEA0000
-Adds ability to restrict parsable formats.
Set the default allowable parse formats at application start up. This will restrict what Coordinate.Parse
can actually parse. Using a system parse call will override this however (ex WebMercator.Parse
).
//Restrict parsable formats to Lat/Long, UTM and MGRS.
GlobalSettings.Default_Parsable_Formats = Allowed_Parse_Format.Lat_Long |
Allowed_Parse_Format.UTM | Allowed_Parse_Format.MGRS;
Restrict parsable formats in the Coordinate.Parse()
or Coordinate.TryParse()
calls.
//Restrict parse format to Lat Long and MGRS only. This example will fail, even though it is a Web Mercator formatted string.
Allowed_Parse_Format formats = Allowed_Parse_Format.Lat_Long | Allowed_Parse_Format.MGRS;
Coordinate c = Coordinate.Parse("91 1", formats);
-Adds .NET 7.0 targets. -Fixes minor parse bugs related to ECEF and eager loading. -Documentation fixes.
BREAKING CHANGE
-Adds Web Mercator EPSG:3857 conversions (for use in mapping applications). Benchmarks changes minimal, but may slightly impact performance in certain use cases. Eager Loading settings may need to be adjusted for users that prefer Lazy Loading.
Conversions follow software standard methods.
Coordinate c = new Coordinate(45, 64);
Console.WriteLine(c.WebMercator.ToString()); //7124447.411mE 5621521.486mN
c = Coordinate.Parse("3624447.411 2721521.486");
Console.WriteLine(c.ToString()); //N 23º 44' 17.003" E 32º 33' 32.274"
-Adds .NET 6.0 targets -Removes obsolete UTM/MGRS boundary check property. -Documentation updates to clarify expected ECEF precision. -Updates commercial license (does not effect existing lifetime license holders).
BREAKING CHANGE
-Adds Web Mercator EPSG:3857 conversions (for use in mapping applications). Benchmarks changes minimal, but may slightly impact performance in certain use cases. Eager Loading settings may need to be adjusted for users that prefer Lazy Loading.
Conversions follow software standard methods.
Coordinate c = new Coordinate(45, 64);
Console.WriteLine(c.WebMercator.ToString()); //7124447.411mE 5621521.486mN
c = Coordinate.Parse("3624447.411 2721521.486");
Console.WriteLine(c.ToString()); //N 23º 44' 17.003" E 32º 33' 32.274"
-Adds .NET 6.0 targets -Removes obsolete UTM/MGRS boundary check property. -Documentation updates to clarify expected ECEF precision.