1

I am using ArcGIS Pro 3.0.0 and a File Geodatabase.

I have a requirement to use Arcade for configuring some Attribute Rules related to the geometry of the features involved which has led me to realize that I am an Arcade beginner. As a learning exercise I am trying to use Arcade for labeling a polyline using the X coordinate of its last vertex without running Calculate Geometry Attributes to add a field first.

I have learned that I can label a polyline with the X coordinate of its first vertex using this Arcade expression:

var first_vertex = Geometry($feature).paths[0][0];
return Text(first_vertex.X);

but how do I label it using the X coordinate of its last vertex?

1 Answer 1

2

The clue to doing this came from Calculate coordinates of Polyline in ArcGIS online with Arcade which I adapted for ArcGIS Pro to write this Arcade code which appears to do what I want:

var path_count = Count(Geometry($feature).paths);
var last_vertex = Geometry($feature).paths[0][path_count-1];
return Text(last_vertex.X);

To get the last vertex I needed to count the number of vertices in the polyline (mine was single part) and subtract 1 from it to use as the index value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.