I am using Esri.ArcGISRuntime package inside a C# program we are writing.
I need to create specific shapes from a reference point and project them in different directions. This is easy to create a new point 5000m away on a 45 degree bearing. ie
var startPoint = new MapPoint(125.4, -33.2, SpatialReferences.Wgs84); var endPoint = GeometryEngine.GeodesicMove(startPoint, 5000, LinearUnits.Meters, 45);
Later on when I need to reverse engineer the points, I can easily recalculate the distance between these points using
var distance = GeometryEngine.GeodesicDistance(startPoint, endPoint, LinearUnits.Meters);
However, I cannot find anyway to determine what the original angle or bearing was between these 2 points.
I have tried using Arctan2, but the MapPoint coordinates are skewed by earth curvature (I think) and therefore straight forward calculation is incorrect.
var degrees = Math.Atan2(endPoint.Y - startPoint.Y, endPoint.X - startPoint.X) / Math.Pi * 180;
The above returns a figure of roughly 39 degrees (PS I tried changing X & Y around as well, no better).