AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

virtual double MgCoordinateSystemMeasure::GetAzimuth ( double  x1,
double  y1,
double  x2,
double  y2 
) [pure virtual]

Computes the angle with respect to the north of a vector formed by two coordinates.

Parameters:
x1 (double) The x value in coordinate system units of the first coordinate.
y1 (double) The y value in coordinate system units of the first coordinate.
x2 (double) The x value in coordinate system units of the second coordinate.
y2 (double) The y value in coordinate system units of the second coordinate.
Returns:
Returns the azimuth (Angle with respect to the North) of the vector formed by (lon1, lat1) and (lon2, lat2).
Example (PHP) (-74.806394, 40.714169) is New York City, and (-71.061342, 42.355892) is Boston, Massachusetts. $azimuth12 is 58.507421025167, and $azimuth21 = -119.00856518347.
 $azimuth12 = $coordSysMeasure->GetAzimuth(-74.806394, 40.714169, -71.061342, 42.355892);
 $azimuth21 = $coordSysMeasure->GetAzimuth(-71.061342, 42.355892, -74.806394, 40.714169);

Example (C#)
 using OSGeo.MapGuide;
 private MgCoordinateSystemMeasure geogCSMeasure;
 private double geogCSX = -160.101421317;
 private double geogCSY = 22.0234263273;
 private double geogCSX1 = -159.721535121256;
 private double geogCSY1 = 24.0028259520524;
 private double geogCSAzimuth = 10.0;
 private double azimuth;
 private double tolerance = 0.001;
 private Boolean isEquivalent;

 azimuth = geogCSMeasure.GetAzimuth(geogCSX, geogCSY, geogCSX1, geogCSY1);
 // azimuth has the value of geogCSDistance
 isEquivalent = Math.Abs(azimuth - geogCSAzimuth) < tolerance;

Exceptions:
MgCoordinateSystemMeasureFailedException