AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

virtual MgCoordinate* MgCoordinateSystemMeasure::GetCoordinate ( MgCoordinate coord,
double  azimuth,
double  distance 
) [pure virtual]

Computes a coordinate given a distance along a vector that is defined by a starting coordinate and an azimuth (Angle with respect to the North).

.NET Syntax
virtual MgCoordinate GetCoordinate(MgCoordinate coord, double azimuth, double distance);
Java Syntax
virtual MgCoordinate GetCoordinate(MgCoordinate coord, double azimuth, double distance);
PHP Syntax
virtual MgCoordinate GetCoordinate(MgCoordinate coord, double azimuth, double distance);

Parameters:
coord (MgCoordinate) An MgCoordinate object in coordinate system units that represents the start of the vector.
azimuth (double) An azimuth (Angle with respect to the North) that defines the direction of the vector.
distance (double) The distance along the vector to the desired coordinate in meters.
Returns:
Returns an MgCoordinate object containing the x and y values in coordinate system units of a coordinate that lies the given distance along the vector.
Example (PHP) See MgCoordinateSystemMeasure::GetAzimuth Method (MgCoordinate*, MgCoordinate*) for the code creating $azimuth12 and $azimuth21. See MgCoordinateSystemMeasure::GetDistance Method (MgCoordinate*, MgCoordinate*) for the code computing the distance between the coordinates. The longitude and latitude of $coord12 is the same as the longitude and latitutde of $coord2, and the longitude and latitude of $coord21 is the same as the longitude and latitude of $coord1.
 $geometryFactory = new MgGeometryFactory();
 $x1 = -74.806394;
 $y1 = 40.714169;
 $coord1 = $geometryFactory->CreateCoordinateXY($x1, $y1);
 $coord12 = $coordSysMeasure->GetCoordinate($coord1, $azimuth12, $distance);
 $x2 = -71.061342;
 $y2 = 42.355892;
 $coord2 = $geometryFactory->CreateCoordinateXY($x2, $y2);
 $coord21 = $coordSysMeasure->GetCoordinate($coord2, $azimuth21, $distance);

Example (C#)
 using OSGeo.MapGuide;
 private MgCoordinateSystemMeasure geogCSMeasure;
 private MgGeometryFactory geometryFactory;
 private MgCoordinate geogCSXYCoord;
 private MgCoordinate geogCSX1Y1Coord;
 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 geogCSDistance = 2.0;
 private double tolerance = 0.001;
 private Boolean isEquivalent;

 geometryFactory = new MgGeometryFactory();
 geogCSXYCoord = geometryFactory.CreateCoordinateXY(geogCSX, geogCSY);
 geogCSX1Y1Coord = geogCSMeasure.GetCoordinate(geogCSXYCoord, geogCSAzimuth, geogCSDistance);
 // the X and Y values of geogCSX1Y1Coord are equal to geogCSX1 and geogCSY1
 isEquivalent = Math.Abs(geogCSX1 - geogCSX1Y1Coord.GetX()) < tolerance && Math.Abs(geogCSY1 - geogCSX1Y1Coord.GetY()) < tolerance;

Exceptions:
MgCoordinateSystemMeasureFailedException 

Implements MgMeasure.