HOW TO

Automatically calculate the length of line features using an attribute rule in ArcGIS Pro

Last Published: April 11, 2025

Summary

In ArcGIS Pro, it is possible to automatically calculate the length of line features using different units of measurement. This functionality can be automated using an attribute rule that triggers when new line features are added or updated on the map. Automating this process helps save time, reduce errors, and ensure accurate updates to the length of line features in the attribute table.

This article provides the workflow to automatically calculate the length of line features using an attribute rule in ArcGIS Pro.

Procedure

Note:
An ArcGIS Pro Standard license or higher is required to create and manage attribute rules.
  1. Open the ArcGIS Pro project.
Note:
The feature layer requires Global IDs to add the attribute rule.
  1. Add a Global ID field to the attribute table of the line feature layer using the Add Global IDs tool.
  2. Create a new field with the double data type. Refer to ArcGIS Pro: Create a field and apply a domain and default value for instructions. In this example, the new field is named Length_Feet.
  3. In the Contents pane, right-click the line feature layer and click Data Design > Attribute Rules.
  4. In the Attribute Rules view, add an attribute rule to the newly created field.
    1. On the Calculation tab, click the Add Rule drop-down menu and select Immediate Calculation.
    2. In the New Rule pane, specify a name for Rule Name. In this example, the rule is named 'Calculate the length in feet’.
    3. For Field, select the new field from the drop-down menu. In this example, Length_Feet is selected.
    4. In the Expression box, specify the following Arcade expression and replace <unit> with the desired unit of measurement. In this example, the Arcade expression uses the geodesic calculation method to populate the new field with the length in feet.
# For planar length
Length($feature, '<unit>')

# For geodesic length
LengthGeodetic($feature, '<unit>')
Note:
The planar calculation only works for measuring lengths in geometries with a defined projected coordinate system, while the geodesic calculation only works with a defined geographic coordinate system. It is best practice to work with data in the same coordinate system when performing edits or analysis on the data. Refer to ArcGIS Pro: Project data to a new coordinate system for more information.
    1. Under Triggers, check the Insert and Update check boxes.
The attribute rules configurations pane
    1. On the Attribute Rules tab, in the Manage Edits group, click Save.

The following image shows the length of the line features automatically calculated when new line features are added to the map.

The length of line features automatically calculated after adding new line features to the map

Article ID: 000035242

Software:
  • ArcGIS Pro

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options