public static string ParsePointToString(PointLatLng point, string scale) { CoordinateSharp.Coordinate c = new CoordinateSharp.Coordinate(point.Lat, point.Lng); Coordinate coordinate = new Coordinate(point.Lat, point.Lng); if (scale == "Signed Degree") { coordinate.Round = 7; return(coordinate.SignedDegree); } else if (scale == "Decimal Degree" || scale == "Lat/Lon d°") { coordinate.Round = 3; return(coordinate.DecimalDegree); } else if (scale == "Degree Decimal Minutes") { coordinate.Round = 3; return(coordinate.DegreeDecimalMinutes); } else if (scale == "Degree Minute Seconds" || scale == "Lat/Lon dms") { coordinate.Round = 3; return(coordinate.DegreeMinuteSeconds); } else if (scale == "UTM") { return(c.UTM.ToString()); } else if (scale == "MGRS") { return(c.MGRS.ToString()); } else if (scale == "Cartesian") { coordinate.Round = 3; return(coordinate.Cartesian.ToString()); } else if (scale == "ECEF") { return(c.ECEF.ToString()); } else if (scale == "GEOREF") { coordinate.GeorefPrecision = 2; return(coordinate.GEOREF.ToString()); } return(null); }
private static Coordinate MGRS_Polar_ToLatLong(MilitaryGridReferenceSystem mgrs, EagerLoad el) { //WORKING bool isNorth = true; if (mgrs.latZone.ToUpper() == "A" || mgrs.latZone.ToUpper() == "B") { isNorth = false; } string latz = mgrs.LatZone; string digraph = mgrs.Digraph; char eltr = digraph[0]; char nltr = digraph[1]; string digraphLettersE; if (!isNorth) { digraphLettersE = "KLPQRSTUXYZABCFGH"; } else { digraphLettersE = "RSTUXYZABCFGHJ"; } string digraphLettersN; if (!isNorth) { digraphLettersN = "VWXYBCDEFGHJKLMNPQRSTUVWXYZ"; } else { digraphLettersN = "ABCDEFGHJKLMNP"; } string digraphLettersAll = ""; for (int lt = 1; lt < 31; lt++) { digraphLettersAll += digraphLettersN; } var eidx = digraphLettersE.IndexOf(eltr); //Offsets are set due to less Easting Identifiers. //North has 4 less than S double offset = 9; if (isNorth) { offset = 13; } if (mgrs.latZone == "B" && eidx < offset && mgrs.easting != 0) { eidx += 18; } double subbase = eidx + offset; var ebase = 100000 * subbase; var latBand = digraphLettersE.IndexOf(latz); var latBandLow = 8 * latBand - 96; var latBandHigh = 8 * latBand - 88; if (!isNorth) { latBandLow = -90; latBandHigh = -80; } else { latBandLow = 84; latBandHigh = 90; } var lowLetter = Math.Floor(100 + 1.11 * latBandLow); var highLetter = Math.Round(100 + 1.11 * latBandHigh); string latBandLetters = null; int l = Convert.ToInt32(lowLetter); int h = Convert.ToInt32(highLetter + 7); if (mgrs.LongZone / 2.0 == Math.Floor(mgrs.LongZone / 2.0)) { latBandLetters = digraphLettersAll.Substring(l + 5, h + 5).ToString(); } else { latBandLetters = digraphLettersAll.Substring(l, h).ToString(); } //North offset + 4 due to lower band count. double nOffset = 13; if (!isNorth) { nOffset = 10; } else { latBandLetters = digraphLettersN; } int index = latBandLetters.IndexOf(nltr); if (index == -1 && nltr == 'A') { index -= 1; } //ALPHA PATCH //int subset = 0; //if ((latz == "Y" || latz == "Z") && (nOffset+index)>25 && (ebase> 2100000 || ebase<2000000) && ebase!= 2000000) { subset = -14; } var nbase = 100000 * (index + nOffset); var x = ebase + mgrs.Easting; var y = nbase + mgrs.Northing; if (mgrs.systemType != MGRS_Type.MGRS_Polar) { if (y > 10000000) { y = y - 10000000; } if (nbase >= 10000000) { y = nbase + mgrs.northing - 10000000; } } // Debug.WriteLine("MGRS {0} {1}", x, y); UniversalTransverseMercator utm = new UniversalTransverseMercator(mgrs.LatZone, mgrs.LongZone, x, y, true); utm.equatorial_radius = mgrs.equatorialRadius; utm.inverse_flattening = mgrs.inverseFlattening; Coordinate c = UniversalTransverseMercator.ConvertUTMtoLatLong(utm, el); c.Set_Datum(mgrs.equatorialRadius, mgrs.inverseFlattening); return(c); }
/// <summary> /// Creates a Signed Degree double[] object from an MGRS/NATO UTM Coordinate /// </summary> /// <param name="mgrs">MilitaryGridReferenceSystem</param> /// <returns>Coordinate object</returns> /// <example> /// The following example creates (converts to) a geodetic Coordinate object based on a MGRS object. /// <code> /// MilitaryGridReferenceSystem mgrs = new MilitaryGridReferenceSystem("N", 21, "SA", 66037, 61982); /// double[] sd = MilitaryGridReferenceSystem.MGRStoSignedDegree(mgrs); /// Coordinate c = new Coordinate(sd[0],sd[1], new EagerLoad(false)); /// Console.WriteLine(c); //N 0º 33' 35.988" W 60º 0' 0.01" /// </code> /// </example> public static double[] MGRStoSignedDegree(MilitaryGridReferenceSystem mgrs) { Regex upsCheck = new Regex("[AaBbYyZz]"); if (upsCheck.IsMatch(mgrs.latZone)) { Coordinate c = MGRStoLatLong(mgrs); return(new double[] { c.Latitude.ToDouble(), c.Longitude.ToDouble() }); } string latz = mgrs.LatZone; string digraph = mgrs.Digraph; char eltr = digraph[0]; char nltr = digraph[1]; string digraphLettersE = "ABCDEFGHJKLMNPQRSTUVWXYZ"; string digraphLettersN = "ABCDEFGHJKLMNPQRSTUV"; string digraphLettersAll = ""; for (int lt = 1; lt < 25; lt++) { digraphLettersAll += "ABCDEFGHJKLMNPQRSTUV"; } var eidx = digraphLettersE.IndexOf(eltr); var nidx = digraphLettersN.IndexOf(nltr); if (mgrs.LongZone / 2.0 == Math.Floor(mgrs.LongZone / 2.0)) { nidx -= 5; // correction for even numbered zones } var ebase = 100000 * (1 + eidx - 8 * Math.Floor(Convert.ToDouble(eidx) / 8)); var latBand = digraphLettersE.IndexOf(latz); var latBandLow = 8 * latBand - 96; var latBandHigh = 8 * latBand - 88; if (latBand < 2) { latBandLow = -90; latBandHigh = -80; } else if (latBand == 21) { latBandLow = 72; latBandHigh = 84; } else if (latBand > 21) { latBandLow = 84; latBandHigh = 90; } var lowLetter = Math.Floor(100 + 1.11 * latBandLow); var highLetter = Math.Round(100 + 1.11 * latBandHigh); string latBandLetters = null; int l = Convert.ToInt32(lowLetter); int h = Convert.ToInt32(highLetter); if (mgrs.LongZone / 2.0 == Math.Floor(mgrs.LongZone / 2.0)) { latBandLetters = digraphLettersAll.Substring(l + 5, h + 5).ToString(); } else { latBandLetters = digraphLettersAll.Substring(l, h).ToString(); } var nbase = 100000 * (lowLetter + latBandLetters.IndexOf(nltr)); //latBandLetters.IndexOf(nltr) value causing incorrect Northing below -80 var x = ebase + mgrs.Easting; var y = nbase + mgrs.Northing; if (y > 10000000) { y = y - 10000000; } if (nbase >= 10000000) { y = nbase + mgrs.northing - 10000000; } var southern = nbase < 10000000; UniversalTransverseMercator utm = new UniversalTransverseMercator(mgrs.LatZone, mgrs.LongZone, x, y); utm.equatorial_radius = mgrs.equatorialRadius; utm.inverse_flattening = mgrs.inverseFlattening; double[] sd = UniversalTransverseMercator.ConvertUTMtoSignedDegree(utm); return(sd); }
//Add main to Coordinate and tunnel to Format class. Add private methods to format. //WHEN PARSING NO EXCPETIONS FOR OUT OF RANGE ARGS WILL BE THROWN public static bool TryParse(string coordString, CartesianType ct, out Coordinate c) { //Turn of eagerload for efficiency EagerLoad eg = new EagerLoad(); eg.Cartesian = false; eg.Celestial = false; eg.UTM_MGRS = false; c = new Coordinate(eg); string s = coordString; s = s.Trim(); //Trim all spaces before and after string double[] d; //Try Signed Degree if (TrySignedDegree(s, out d)) { try { c = new Coordinate(d[0], d[1], eg); c.Parse_Format = Parse_Format_Type.Signed_Degree; return(true); } catch {//Parser failed try next method } } //Try Decimal Degree if (TryDecimalDegree(s, out d)) { try { c = new Coordinate(d[0], d[1], eg); c.Parse_Format = Parse_Format_Type.Decimal_Degree; return(true); } catch {//Parser failed try next method } } //Try DDM if (TryDegreeDecimalMinute(s, out d)) { try { //0 Lat Degree //1 Lat Minute //2 Lat Direction (0 = N, 1 = S) //3 Long Degree //4 Long Minute //5 Long Direction (0 = E, 1 = W) CoordinatesPosition latP = CoordinatesPosition.N; CoordinatesPosition lngP = CoordinatesPosition.E; if (d[2] != 0) { latP = CoordinatesPosition.S; } if (d[5] != 0) { lngP = CoordinatesPosition.W; } CoordinatePart lat = new CoordinatePart((int)d[0], d[1], latP); CoordinatePart lng = new CoordinatePart((int)d[3], d[4], lngP); c = new Coordinate(eg); c.Latitude = lat; c.Longitude = lng; c.Parse_Format = Parse_Format_Type.Degree_Decimal_Minute; return(true); } catch {//Parser failed try next method } } //Try DMS if (TryDegreeMinuteSecond(s, out d)) { try { //0 Lat Degree //1 Lat Minute //2 Lat Second //3 Lat Direction (0 = N, 1 = S) //4 Long Degree //5 Long Minute //6 Long Second //7 Long Direction (0 = E, 1 = W) CoordinatesPosition latP = CoordinatesPosition.N; CoordinatesPosition lngP = CoordinatesPosition.E; if (d[3] != 0) { latP = CoordinatesPosition.S; } if (d[7] != 0) { lngP = CoordinatesPosition.W; } CoordinatePart lat = new CoordinatePart((int)d[0], (int)d[1], d[2], latP); CoordinatePart lng = new CoordinatePart((int)d[4], (int)d[5], d[6], lngP); c = new Coordinate(eg); c.Latitude = lat; c.Longitude = lng; c.Parse_Format = Parse_Format_Type.Degree_Minute_Second; return(true); } catch {//Parser failed try next method } } string[] um; //Try MGRS if (TryMGRS(s, out um) || TryMGRS_Polar(s, out um)) { try { double zone = Convert.ToDouble(um[0]); double easting = Convert.ToDouble(um[3]); double northing = Convert.ToDouble(um[4]); MilitaryGridReferenceSystem mgrs = new MilitaryGridReferenceSystem(um[1], (int)zone, um[2], easting, northing); c = MilitaryGridReferenceSystem.MGRStoLatLong(mgrs); c.Parse_Format = Parse_Format_Type.MGRS; return(true); } catch {//Parser failed try next method } } //Try UTM if (TryUTM(s, out um) || TryUPS(s, out um)) { try { double zone = Convert.ToDouble(um[0]); double easting = Convert.ToDouble(um[2]); double northing = Convert.ToDouble(um[3]); UniversalTransverseMercator utm = new UniversalTransverseMercator(um[1], (int)zone, easting, northing); c = UniversalTransverseMercator.ConvertUTMtoLatLong(utm); c.Parse_Format = Parse_Format_Type.UTM; return(true); } catch {//Parser failed try next method } } //Try Cartesian if (TryCartesian(s.ToUpper().Replace("KM", "").Replace("X", "").Replace("Y", "").Replace("Z", ""), out d)) { if (ct == CartesianType.Cartesian) { try { Cartesian cart = new Cartesian(d[0], d[1], d[2]); c = Cartesian.CartesianToLatLong(cart); c.Parse_Format = Parse_Format_Type.Cartesian_Spherical; return(true); } catch {//Parser failed try next method } } if (ct == CartesianType.ECEF) { try { ECEF ecef = new ECEF(d[0], d[1], d[2]); c = ECEF.ECEFToLatLong(ecef); c.Parse_Format = Parse_Format_Type.Cartesian_ECEF; return(true); } catch {//Parser failed try next method } } } c = null; return(false); }
/// <summary> /// Creates a Coordinate object from an MGRS/NATO UTM Coordinate /// </summary> /// <param name="mgrs">MilitaryGridReferenceSystem</param> /// <param name="eagerLoad">EagerLoad</param> /// <returns>Coordinate object</returns> /// <example> /// The following example creates (converts to) a geodetic Coordinate object based on a MGRS object. /// <code> /// MilitaryGridReferenceSystem mgrs = new MilitaryGridReferenceSystem("N", 21, "SA", 66037, 61982); /// Coordinate c = MilitaryGridReferenceSystem.MGRStoLatLong(mgrs, new EagerLoad(false)); /// Console.WriteLine(c); //N 0º 33' 35.988" W 60º 0' 0.01" /// </code> /// </example> public static Coordinate MGRStoLatLong(MilitaryGridReferenceSystem mgrs, EagerLoad eagerLoad) { if (mgrs.systemType == MGRS_Type.MGRS_Polar) { return(MGRS_Polar_ToLatLong(mgrs, eagerLoad)); } string latz = mgrs.LatZone; string digraph = mgrs.Digraph; char eltr = digraph[0]; char nltr = digraph[1]; string digraphLettersE = "ABCDEFGHJKLMNPQRSTUVWXYZ"; string digraphLettersN = "ABCDEFGHJKLMNPQRSTUV"; string digraphLettersAll = ""; for (int lt = 1; lt < 25; lt++) { digraphLettersAll += digraphLettersN; } var eidx = digraphLettersE.IndexOf(eltr); var pbase = 100000; double fl = Math.Floor(Convert.ToDouble(eidx) / 8); double subbase = 1 + eidx - 8 * fl; var ebase = pbase * subbase; var latBand = digraphLettersE.IndexOf(latz); var latBandLow = 8 * latBand - 96; var latBandHigh = 8 * latBand - 88; if (latBand < 2) { latBandLow = -90; latBandHigh = -80; } else if (latBand == 21) { latBandLow = 72; latBandHigh = 84; } else if (latBand > 21) { latBandLow = 84; latBandHigh = 90; } var lowLetter = Math.Floor(100 + 1.11 * latBandLow); var highLetter = Math.Round(100 + 1.11 * latBandHigh); string latBandLetters = null; int l = Convert.ToInt32(lowLetter); int h = Convert.ToInt32(highLetter); if (mgrs.LongZone / 2.0 == Math.Floor(mgrs.LongZone / 2.0)) { latBandLetters = digraphLettersAll.Substring(l + 5, h + 5).ToString(); } else { latBandLetters = digraphLettersAll.Substring(l, h).ToString(); } var nbase = 100000 * (lowLetter + latBandLetters.IndexOf(nltr)); //latBandLetters.IndexOf(nltr) value causing incorrect Northing below -80 var x = ebase + mgrs.Easting; var y = nbase + mgrs.Northing; if (mgrs.systemType != MGRS_Type.MGRS_Polar) { if (y > 10000000) { y = y - 10000000; } if (nbase >= 10000000) { y = nbase + mgrs.northing - 10000000; } } UniversalTransverseMercator utm = new UniversalTransverseMercator(mgrs.LatZone, mgrs.LongZone, x, y, true); utm.equatorial_radius = mgrs.equatorialRadius; utm.inverse_flattening = mgrs.inverseFlattening; Coordinate c = UniversalTransverseMercator.ConvertUTMtoLatLong(utm, eagerLoad); c.Set_Datum(mgrs.equatorialRadius, mgrs.inverseFlattening); return(c); }
/// <summary> /// Constructs a UTM object based off a UTM coordinate /// Not yet implemented /// </summary> /// <param name="latz">Zone Letter</param> /// <param name="longz">Zone Number</param> /// <param name="e">Easting</param> /// <param name="n">Northing</param> /// <param name="c">Parent Coordinate Object</param> /// <param name="rad">Equatorial Radius</param> /// <param name="flt">Inverse Flattening</param> internal UniversalTransverseMercator(string latz, int longz, double e, double n, Coordinate c, double rad, double flt) { //validate utm if (longz < 1 || longz > 60) { Debug.WriteLine("Longitudinal zone out of range", "UTM longitudinal zones must be between 1-60."); } if (!Verify_Lat_Zone(latz)) { throw new ArgumentException("Latitudinal zone invalid", "UTM latitudinal zone was unrecognized."); } if (e < 160000 || e > 834000) { Debug.WriteLine("The Easting value provided is outside the max allowable range. If this is intentional, use with caution."); } if (n < 0 || n > 10000000) { throw new ArgumentOutOfRangeException("Northing out of range", "Northing must be between 0-10,000,000."); } this.equatorial_radius = rad; this.inverse_flattening = flt; latZone = latz; longZone = longz; easting = e; northing = n; coordinate = c; }
private static Coordinate UTMtoLatLong(double x, double y, double zone, double equatorialRadius, double flattening) { //x easting //y northing //http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html double phif, Nf, Nfpow, nuf2, ep2, tf, tf2, tf4, cf; double x1frac, x2frac, x3frac, x4frac, x5frac, x6frac, x7frac, x8frac; double x2poly, x3poly, x4poly, x5poly, x6poly, x7poly, x8poly; double sm_a = equatorialRadius; double sm_b = equatorialRadius * (1 - (1.0 / flattening)); //Polar Radius /* Get the value of phif, the footpoint latitude. */ phif = FootpointLatitude(y, equatorialRadius, flattening); /* Precalculate ep2 */ ep2 = (Math.Pow(sm_a, 2.0) - Math.Pow(sm_b, 2.0)) / Math.Pow(sm_b, 2.0); /* Precalculate cos (phif) */ cf = Math.Cos(phif); /* Precalculate nuf2 */ nuf2 = ep2 * Math.Pow(cf, 2.0); /* Precalculate Nf and initialize Nfpow */ Nf = Math.Pow(sm_a, 2.0) / (sm_b * Math.Sqrt(1 + nuf2)); Nfpow = Nf; /* Precalculate tf */ tf = Math.Tan(phif); tf2 = tf * tf; tf4 = tf2 * tf2; /* Precalculate fractional coefficients for x**n in the equations * below to simplify the expressions for latitude and longitude. */ x1frac = 1.0 / (Nfpow * cf); Nfpow *= Nf; /* now equals Nf**2) */ x2frac = tf / (2.0 * Nfpow); Nfpow *= Nf; /* now equals Nf**3) */ x3frac = 1.0 / (6.0 * Nfpow * cf); Nfpow *= Nf; /* now equals Nf**4) */ x4frac = tf / (24.0 * Nfpow); Nfpow *= Nf; /* now equals Nf**5) */ x5frac = 1.0 / (120.0 * Nfpow * cf); Nfpow *= Nf; /* now equals Nf**6) */ x6frac = tf / (720.0 * Nfpow); Nfpow *= Nf; /* now equals Nf**7) */ x7frac = 1.0 / (5040.0 * Nfpow * cf); Nfpow *= Nf; /* now equals Nf**8) */ x8frac = tf / (40320.0 * Nfpow); /* Precalculate polynomial coefficients for x**n. * -- x**1 does not have a polynomial coefficient. */ x2poly = -1.0 - nuf2; x3poly = -1.0 - 2 * tf2 - nuf2; x4poly = 5.0 + 3.0 * tf2 + 6.0 * nuf2 - 6.0 * tf2 * nuf2 - 3.0 * (nuf2 * nuf2) - 9.0 * tf2 * (nuf2 * nuf2); x5poly = 5.0 + 28.0 * tf2 + 24.0 * tf4 + 6.0 * nuf2 + 8.0 * tf2 * nuf2; x6poly = -61.0 - 90.0 * tf2 - 45.0 * tf4 - 107.0 * nuf2 + 162.0 * tf2 * nuf2; x7poly = -61.0 - 662.0 * tf2 - 1320.0 * tf4 - 720.0 * (tf4 * tf2); x8poly = 1385.0 + 3633.0 * tf2 + 4095.0 * tf4 + 1575 * (tf4 * tf2); /* Calculate latitude */ double nLat = phif + x2frac * x2poly * (x * x) + x4frac * x4poly * Math.Pow(x, 4.0) + x6frac * x6poly * Math.Pow(x, 6.0) + x8frac * x8poly * Math.Pow(x, 8.0); /* Calculate longitude */ double nLong = zone + x1frac * x + x3frac * x3poly * Math.Pow(x, 3.0) + x5frac * x5poly * Math.Pow(x, 5.0) + x7frac * x7poly * Math.Pow(x, 7.0); double dLat = RadToDeg(nLat); double dLong = RadToDeg(nLong); if (dLat > 90) { dLat = 90; } if (dLat < -90) { dLat = -90; } if (dLong > 180) { dLong = 180; } if (dLong < -180) { dLong = -180; } Coordinate c = new Coordinate(equatorialRadius, flattening, true); CoordinatePart cLat = new CoordinatePart(dLat, CoordinateType.Lat, c); CoordinatePart cLng = new CoordinatePart(dLong, CoordinateType.Long, c); c.Latitude = cLat; c.Longitude = cLng; return(c); }
/// <summary> /// Attempts to parse a string into a Coordinate with specified DateTime /// </summary> /// <param name="value">Coordinate string</param> /// <param name="geoDate">GeoDate</param> /// <param name="coordinate">Coordinate</param> /// <param name="cartesianType">Cartesian Type</param> /// <returns>boolean</returns> /// <example> /// The following example parses an ECEF formatted coordinate string, with an included GeoDate. /// Because this is an ECEF Cartesian type coordinate, we will specify the Cartesian system type. /// <code> /// Coordinate c; /// if(Coordinate.TryParse("5242.097 km, 2444.43 km, 2679.074 km", new DateTime(2018,7,7), CartesianType.ECEF, out c)) /// { /// Console.WriteLine(c); //N 24º 59' 59.987" E 25º 0' 0.001" /// } /// </code> /// </example> public static bool TryParse(string value, DateTime geoDate, CartesianType cartesianType, out Coordinate coordinate) { coordinate = null; if (FormatFinder.TryParse(value, cartesianType, out coordinate)) { Parse_Format_Type pft = coordinate.Parse_Format; if (cartesianType == CartesianType.ECEF) { Distance h = coordinate.ecef.GeoDetic_Height; coordinate = new Coordinate(coordinate.Latitude.ToDouble(), coordinate.Longitude.ToDouble(), geoDate); //Reset with EagerLoad back on. coordinate.ecef.Set_GeoDetic_Height(coordinate, h); } else { coordinate = new Coordinate(coordinate.Latitude.ToDouble(), coordinate.Longitude.ToDouble(), geoDate); //Reset with EagerLoad back on. } coordinate.parse_Format = pft; return(true); } return(false); }
/// <summary> /// Returns the distance from a target coordinate. /// </summary> /// <param name="target">Target coordinate</param> /// <param name="shape">Earth shape</param> /// <returns>Distance</returns> /// <example> /// The following example demonstrates how to obtain the distance from a target coordinate /// using ellipsoidal earth calculations. /// <code> /// Coordinate coord = new Coordinate(25,25); /// Coordinate target = new Coordinate(28, 30); /// /// //Get distance from target using ellipsoidal calculations /// Distance d = coord.Get_Distance_From_Coordinate(target, Shape.Ellipsoid); /// /// Console.Writeline(d.Kilometers); //599.002436777727 /// </code> /// </example> public Distance Get_Distance_From_Coordinate(Coordinate target, Shape shape) { return(new Distance(this, target, shape)); }
/*DISTANCE & MOVING METHODS*/ /// <summary> /// Returns the distance from a target coordinate using spherical earth calculations. /// Use overload if ellipsoidal calculations are desired. /// </summary> /// <param name="target">Coordinate</param> /// <returns>Distance</returns> /// <example> /// The following example demonstrates how to obtain the distance from a target coordinate /// using default spherical earth calculations. /// <code> /// Coordinate coord = new Coordinate(25, 25); /// Coordinate target = new Coordinate(28, 30); /// /// //Get distance from target using default spherical calculations /// Distance d = coord.Get_Distance_From_Coordinate(target); /// /// Console.Writeline(d.Kilometers); //598.928622714691 /// </code> /// </example> public Distance Get_Distance_From_Coordinate(Coordinate target) { return(new Distance(this, target)); }
public static List <List <string> > CalculateLunarEclipse(DateTime d, Coordinate coord) { return(Calculate(d, coord.Latitude.ToRadians(), coord.Longitude.ToRadians())); }
/// <summary> /// Initializes a distance object using Haversine (Spherical Earth). /// </summary> /// <param name="c1">Coordinate 1</param> /// <param name="c2">Coordinate 2</param> public Distance(Coordinate c1, Coordinate c2) { Haversine(c1, c2); }