Select to view content in your preferred language

Bearing (direction) Calculation Difficulties

267
0
05-13-2024 10:32 AM
Labels (2)
FranciscoCastillo
New Contributor

I am attempting to create an arcade script that would auto-calculate bearing (direction) in Field Maps. The script is successfully verified in the Field Map forms section and in the Arcade Playground. Attempting to create a feature in Field  Maps, AGOL, or in ArcPro fails to calculate the attribute field. My script is as follows,

var first_x = Geometry($feature).paths[0][0].x
var first_y = Geometry($feature).paths[0][0].y
var last_x = Geometry($feature).paths[-1][-1].x
var last_y = Geometry($feature).paths[-1][-1].y
var first_coordinate = Point({ "x":first_x, "y": first_y, "spatial reference": {"wkid": 3857} })
var last_coordinate = Point({ "x":last_x, "y": last_y, "spatial reference": {"wkid": 3857} })
Round(Bearing(first_coordinate, last_coordinate), 2)
 
Anything helps.
 
Thanks,
Francisco Castillo

 

0 Kudos
0 Replies