CalculateGeodeticMeasurement() public static method

Calculate the three dimensional geodetic measurement between two positions measured in reference to a specified ellipsoid. This calculation is performed by first computing a new ellipsoid by expanding or contracting the reference ellipsoid such that the new ellipsoid passes through the average elevation of the two positions. A geodetic curve across the new ellisoid is calculated. The point-to-point distance is calculated as the hypotenuse of a right triangle where the length of one side is the ellipsoidal distance and the other is the difference in elevation.
public static CalculateGeodeticMeasurement ( Gavaghan.Geodesy.Ellipsoid refEllipsoid, GlobalPosition start, GlobalPosition end ) : GeodeticMeasurement
refEllipsoid Gavaghan.Geodesy.Ellipsoid reference ellipsoid to use
start GlobalPosition starting position
end GlobalPosition ending position
return GeodeticMeasurement
示例#1
0
    public void TestCalculateGeodeticMeasurement()
    {
      // instantiate the calculator
      GeodeticCalculator geoCalc = new GeodeticCalculator();

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

      // set Pike's Peak position
      GlobalPosition pikesPeak;
      pikesPeak = new GlobalPosition(new GlobalCoordinates(new Angle(38.840511), new Angle(-105.0445896)), 4301.0);

      // set Alcatraz Island coordinates
      GlobalPosition alcatrazIsland;
      alcatrazIsland = new GlobalPosition(new GlobalCoordinates(new Angle(37.826389), new Angle(-122.4225)), 0.0);

      // calculate the geodetic measurement
      GeodeticMeasurement geoMeasurement;

      geoMeasurement = geoCalc.CalculateGeodeticMeasurement(reference, pikesPeak, alcatrazIsland);

      Assert.AreEqual(-4301.0, geoMeasurement.ElevationChange, 0.001);
      Assert.AreEqual(1521788.826, geoMeasurement.PointToPointDistance, 0.001);
      Assert.AreEqual(1521782.748, geoMeasurement.EllipsoidalDistance, 0.001);
      Assert.AreEqual(271.21039153, geoMeasurement.Azimuth.Degrees, 0.0000001);
      Assert.AreEqual(80.38029386, geoMeasurement.ReverseAzimuth.Degrees, 0.0000001);
    }
示例#2
0
 public static GeodeticMeasurement CalculateDistance(double lat1, double lon1, double lat2, double lon2)
 {
     GlobalCoordinates p1 = new GlobalCoordinates(new Angle(lat1), new Angle(lon1));
     GlobalCoordinates p2 = new GlobalCoordinates(new Angle(lat2), new Angle(lon2));
     GeodeticCalculator gc = new GeodeticCalculator();
     GlobalPosition gp1 = new GlobalPosition(p1);
     GlobalPosition gp2 = new GlobalPosition(p2);
     GeodeticMeasurement gm = gc.CalculateGeodeticMeasurement(Ellipsoid.WGS84, gp1, gp2);
     return gm;
 }
示例#3
0
文件: Example.cs 项目: heinzsack/DEV
	/// <summary>
	/// Calculate the three-dimensional path from
	///    Pike's Peak in Colorado --> 38.840511N, 105.0445896W, 4301 meters
	///        to
	///    Alcatraz Island --> 37.826389N, 122.4225W, sea level
	///        using
	///    WGS84 reference ellipsoid
	/// </summary>
	static void ThreeDimensionalInverseCalculation()
	{
	  // instantiate the calculator
	  GeodeticCalculator geoCalc = new GeodeticCalculator();

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

	  // set Pike's Peak position
	  GlobalPosition pikesPeak;
	  pikesPeak = new GlobalPosition(
		new GlobalCoordinates(new Angle(38.840511), new Angle(-105.0445896)),
		4301.0
	  );

	  // set Alcatraz Island coordinates
	  GlobalPosition alcatrazIsland;
	  alcatrazIsland = new GlobalPosition(
		new GlobalCoordinates(new Angle(37.826389), new Angle(-122.4225)),
		0.0
	  );

	  // calculate the geodetic measurement
	  GeodeticMeasurement geoMeasurement;
	  double p2pKilometers;
	  double p2pMiles;
	  double elevChangeMeters;
	  double elevChangeFeet;

	  geoMeasurement = geoCalc.CalculateGeodeticMeasurement(reference, pikesPeak, alcatrazIsland);
	  p2pKilometers = geoMeasurement.PointToPointDistance / 1000.0;
	  p2pMiles = p2pKilometers * 0.621371192;
	  elevChangeMeters = geoMeasurement.ElevationChange;
	  elevChangeFeet = elevChangeMeters * 3.2808399;

	  Console.WriteLine("3-D path from Pike's Peak to Alcatraz Island using WGS84");
	  Console.WriteLine("   Point-to-Point Distance: {0:0.00} kilometers ({1:0.00} miles)", p2pKilometers, p2pMiles);
	  Console.WriteLine("   Elevation change:        {0:0.0} meters ({1:0.0} feet)", elevChangeMeters, elevChangeFeet);
	  Console.WriteLine("   Azimuth:                 {0:0.00} degrees", geoMeasurement.Azimuth.Degrees);
	  Console.WriteLine("   Reverse Azimuth:         {0:0.00} degrees", geoMeasurement.ReverseAzimuth.Degrees);
	}