CalculateGeodeticCurve() public static method

Calculate the geodetic curve between two points on a specified reference ellipsoid. This is the solution to the inverse geodetic problem.
public static CalculateGeodeticCurve ( Gavaghan.Geodesy.Ellipsoid ellipsoid, GlobalCoordinates start, GlobalCoordinates end ) : GeodeticCurve
ellipsoid Gavaghan.Geodesy.Ellipsoid reference ellipsoid to use
start GlobalCoordinates starting coordinates
end GlobalCoordinates ending coordinates
return GeodeticCurve
Beispiel #1
0
	/// <summary>
	/// Calculate the two-dimensional path from
	///    Lincoln Memorial in Washington, D.C --> 38.8892N, 77.04978W
	///         to
	///    Eiffel Tower in Paris --> 48.85889N, 2.29583E
	///         using
	///    WGS84 reference ellipsoid
	/// </summary>
	static void TwoDimensionalInverseCalculation()
	{
	  // instantiate the calculator
	  GeodeticCalculator geoCalc = new GeodeticCalculator();

	  // select a reference elllipsoid
	  Ellipsoid reference = Ellipsoid.WGS84;

	  // set Lincoln Memorial coordinates
	  GlobalCoordinates lincolnMemorial;
	  lincolnMemorial = new GlobalCoordinates(
		  new Angle(38.88922), new Angle(-77.04978)
	  );

	  // set Eiffel Tower coordinates
	  GlobalCoordinates eiffelTower;
	  eiffelTower = new GlobalCoordinates(
		  new Angle(48.85889), new Angle(2.29583)
	  );

	  // calculate the geodetic curve
	  GeodeticCurve geoCurve = geoCalc.CalculateGeodeticCurve(reference, lincolnMemorial, eiffelTower);
	  double ellipseKilometers = geoCurve.EllipsoidalDistance / 1000.0;
	  double ellipseMiles = ellipseKilometers * 0.621371192;

	  Console.WriteLine("2-D path from Lincoln Memorial to Eiffel Tower using WGS84");
	  Console.WriteLine("   Ellipsoidal Distance: {0:0.00} kilometers ({1:0.00} miles)", ellipseKilometers, ellipseMiles);
	  Console.WriteLine("   Azimuth:              {0:0.00} degrees", geoCurve.Azimuth.Degrees);
	  Console.WriteLine("   Reverse Azimuth:      {0:0.00} degrees", geoCurve.ReverseAzimuth.Degrees);
	}
    public void TestCalculateGeodeticCurve()
    {
      // instantiate the calculator
      GeodeticCalculator geoCalc = new GeodeticCalculator();

      // select a reference elllipsoid
      Ellipsoid reference = Ellipsoid.WGS84;

      // set Lincoln Memorial coordinates
      GlobalCoordinates lincolnMemorial;
      lincolnMemorial = new GlobalCoordinates(38.88922, -77.04978);

      // set Eiffel Tower coordinates
      GlobalCoordinates eiffelTower;
      eiffelTower = new GlobalCoordinates(48.85889, 2.29583);

      // calculate the geodetic curve
      GeodeticCurve geoCurve = geoCalc.CalculateGeodeticCurve(reference, lincolnMemorial, eiffelTower);

      Assert.AreEqual(6179016.136, geoCurve.EllipsoidalDistance, 0.001);
      Assert.AreEqual(51.76792142, geoCurve.Azimuth.Degrees, 0.0000001);
      Assert.AreEqual(291.75529334, geoCurve.ReverseAzimuth.Degrees, 0.0000001);
    }
Beispiel #3
0
        private void DoGeodaeticCalculations ()
            {
            DataRow RootRow = MapDataWrapper.Instance.GetMapKachelRootImageRow (TypenName, RootKachelName);
            GeodeticCalculator GeoCalc = new GeodeticCalculator();
            Ellipsoid ReferenceModell = Ellipsoid.WGS84;
            GlobalCoordinates TopLeftStart = new GlobalCoordinates
                (new Angle(Convert.ToDouble(RootRow["TopY"])), new Angle(Convert.ToDouble(RootRow["LeftX"])));
            GlobalCoordinates TopRightEnd = new GlobalCoordinates
                (new Angle(Convert.ToDouble(RootRow["TopY"])), new Angle(Convert.ToDouble(RootRow["RightX"])));
            GlobalCoordinates BottomLeftStart = new GlobalCoordinates
                (new Angle(Convert.ToDouble(RootRow["BottomY"])), new Angle(Convert.ToDouble(RootRow["LeftX"])));
            GlobalCoordinates BottomRightEnd = new GlobalCoordinates
                (new Angle(Convert.ToDouble(RootRow["BottomY"])), new Angle(Convert.ToDouble(RootRow["RightX"])));

            GeodeticCurve TopCurve = GeoCalc.CalculateGeodeticCurve(ReferenceModell, TopLeftStart, TopRightEnd);
            double TopMeters = TopCurve.EllipsoidalDistance;

            GeodeticCurve BottomCurve = GeoCalc.CalculateGeodeticCurve(ReferenceModell, BottomLeftStart, BottomRightEnd);
            double BottomMeters = BottomCurve.EllipsoidalDistance;

            GeodeticCurve LeftCurve = GeoCalc.CalculateGeodeticCurve(ReferenceModell, BottomLeftStart, TopLeftStart);
            double LeftMeters = LeftCurve.EllipsoidalDistance;

            GeodeticCurve RightCurve = GeoCalc.CalculateGeodeticCurve(ReferenceModell, BottomRightEnd, TopRightEnd);
            double RightMeters = RightCurve.EllipsoidalDistance;

            LeftToRightDistance = (TopMeters + BottomMeters) / 2.0;
            BottomToTopDistance = (LeftMeters + RightMeters) / 2.0;

            LeftMeasure = new Point (Convert.ToDouble(RootRow["LeftX"]), Convert.ToDouble(RootRow["TopY"]));
            TopMeasure = new Point (Convert.ToDouble(RootRow["LeftX"]), Convert.ToDouble(RootRow["TopY"]));
            RightMeasure = new Point (Convert.ToDouble(RootRow["RightX"]), Convert.ToDouble(RootRow["BottomY"]));
            BottomMeasure = new Point (Convert.ToDouble(RootRow["RightX"]), Convert.ToDouble(RootRow["BottomY"]));
            double MaxDrawingAreaAspectRatio = MaxDrawingWidth / MaxDrawingHeight;
            double RootKachelAspectRatio = LeftToRightDistance / BottomToTopDistance;
            if (RootKachelAspectRatio >= MaxDrawingAreaAspectRatio)
                {
                FullDrawingWidth = MaxDrawingWidth;
                FullDrawingHeight = FullDrawingWidth / RootKachelAspectRatio;
                }
            else
                {
                FullDrawingHeight = MaxDrawingHeight;
                FullDrawingWidth = FullDrawingHeight * RootKachelAspectRatio;
                }
            }
    public void TestAntiPodal2()
    {
      // instantiate the calculator
      GeodeticCalculator geoCalc = new GeodeticCalculator();

      // select a reference elllipsoid
      Ellipsoid reference = Ellipsoid.WGS84;

      // set position 1
      GlobalCoordinates p1;
      p1 = new GlobalCoordinates(11, 80);

      // set position 2
      GlobalCoordinates p2;
      p2 = new GlobalCoordinates(-10, -100);

      // calculate the geodetic measurement
      GeodeticCurve geoCurve;

      geoCurve = geoCalc.CalculateGeodeticCurve(reference, p1, p2);

      Assert.AreEqual(19893320.272061437, geoCurve.EllipsoidalDistance, 0.001);
      Assert.AreEqual(360.0, geoCurve.Azimuth.Degrees, 0.0000001);
      Assert.AreEqual(0.0, geoCurve.ReverseAzimuth.Degrees, 0.0000001);
    }
    public void TestAntiPodal1()
    {
      // instantiate the calculator
      GeodeticCalculator geoCalc = new GeodeticCalculator();

      // select a reference elllipsoid
      Ellipsoid reference = Ellipsoid.WGS84;

      // set position 1
      GlobalCoordinates p1;
      p1 = new GlobalCoordinates(10, 80.6);

      // set position 2
      GlobalCoordinates p2;
      p2 = new GlobalCoordinates(-10, -100);

      // calculate the geodetic measurement
      GeodeticCurve geoCurve;

      geoCurve = geoCalc.CalculateGeodeticCurve(reference, p1, p2);

      Assert.AreEqual(19970718.422432076, geoCurve.EllipsoidalDistance, 0.001);
      Assert.AreEqual(90.0004877491174, geoCurve.Azimuth.Degrees, 0.0000001);
      Assert.AreEqual(270.0004877491174, geoCurve.ReverseAzimuth.Degrees, 0.0000001);
    }
    public void TestInverseWithDirect()
    {
      // instantiate the calculator
      GeodeticCalculator geoCalc = new GeodeticCalculator();

      // select a reference elllipsoid
      Ellipsoid reference = Ellipsoid.WGS84;

      // set Lincoln Memorial coordinates
      GlobalCoordinates lincolnMemorial;
      lincolnMemorial = new GlobalCoordinates( new Angle(38.88922), new Angle(-77.04978));

      // set Eiffel Tower coordinates
      GlobalCoordinates eiffelTower;
      eiffelTower = new GlobalCoordinates(48.85889, 2.29583);

      // calculate the geodetic curve
      GeodeticCurve geoCurve = geoCalc.CalculateGeodeticCurve(reference, lincolnMemorial, eiffelTower);

      // now, plug the result into to direct solution
      GlobalCoordinates dest;
      Angle endBearing = new Angle();

      dest = geoCalc.CalculateEndingGlobalCoordinates(reference, lincolnMemorial, geoCurve.Azimuth, geoCurve.EllipsoidalDistance, out endBearing);

      Assert.AreEqual(eiffelTower.Latitude.Degrees, dest.Latitude.Degrees, 0.0000001);
      Assert.AreEqual(eiffelTower.Longitude.Degrees, dest.Longitude.Degrees, 0.0000001);
    }