What is best way to determine angle between two mappoints?
Solved! Go to Solution.
There are probably a number of approaches. I suggest using a LineBuilder to create a LineSegment using the two points as the start and the end point. The created segment in return contains an angle property.
https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic7741.html
There are probably a number of approaches. I suggest using a LineBuilder to create a LineSegment using the two points as the start and the end point. The created segment in return contains an angle property.
https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic7741.html
Alternatively, you may take a look at the Near Tool as well as the Generate Near Table Tool. Each allow you to generate the angle.
so i think like the linesegment approach but it returns the angle relative to x axis going counter clockwise as opposed to the preferable gis coordinate system starting at y axis in a clockwise direction. so if the lineSegment.angle returns 30 degrees that would actually be 60 degrees on the compass. Is there a method or technique to make the conversion?
this seems to work for me thanks for help
double Rad2Degrees = 180 / Math.PI;
var lineBuilder = new LineBuilder(p1, p2);
var lineSeg = lineBuilder.ToSegment();
var degrees = lineSeg.Angle * Rad2Degrees;
degrees = 90 - degrees;
if (degrees < 0)
degrees = degrees + 360;