Anyone have a code snippet I can use to accomplish this?
I'm currently answering a similar question here:
Re: How to calculate the angle of a line respect t... - Esri Community
Calculate Geometry Attributes can calculate Line Bearing, if that's what you need.
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/calculate-geometry-attributes.htm
or old school
Solved: Calculating polyline azimuth - code error - Esri Community
This is what I ended up going with. Thanks!
// get a list of line parts var paths = Geometry($feature).paths // for each part, loop through each segment and get its angle (arithmetic angle -> East=0°, North=90°) var angles = [] for(var p in paths) { var count_p = Count(paths[p]) for(var q = 1; q < count_p; q ++) { var a = Angle(paths[p][q], paths[p][q-1]) Push(angles, a) } } // get the mean arithmetic angle var arith_angle = Mean(angles) // rotate so that North = 0° var north_arith_angle = arith_angle - 180 return north_arith_angle + IIF(north_arith_angle < 0, 180, 0)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.