HOW TO

Calculate the distance between specific vertices of a polyline feature in ArcGIS Pro

Last Published: August 5, 2022

Summary

In ArcGIS Pro, a polyline is a shape defined by one or more paths where a path consists of a series of connected segments. The Calculate Geometry Attributes tool is used to add information to a feature's attribute fields. However, the tool is unable to calculate the distance between specific vertices of a polyline feature as the tool calculates the distance between the first and the last vertices.

This article provides the workflow to calculate the distance between specific vertices of a polyline feature. In this example, the distance between the two vertices of a bridge over the Blackfriars Underpass, London is calculated.

Map featuring the polyline feature, a bridge over the Blackfriars Underpass, London, containing ten vertices.

Procedure

In this workaround, the polyline feature is copied to a new feature class where the unwanted vertices are removed to calculate the distance between the specific vertices. The Add Join tool and the Calculate Field tool are then used to transfer the result to the original feature class.

  1. In ArcGIS Pro, create a new feature layer using the Create Feature Class tool. Refer to ArcGIS Pro: Open the map and add your data for instructions. For Geometry Type, click the drop-down arrow and select Polyline. In this example, the new feature layer is LAYER_2.
  2. Copy the polyline feature from the source layer and paste it in the new layer. Refer to ArcGIS Pro: Copy and paste features using the clipboard for more information. In this example, the polyline feature is copied from the source layer, LAYER_1, and pasted in the new layer, LAYER_2.
  3. Add a new field to LAYER_1 and LAYER_2.
    1. In the Contents pane, right-click one of the layers, and click Design > Fields.
The Contents pane featuring the Fields view tab to navigate to the Design and select Fields.
  1. Add a new field to the table. Refer to ArcGIS Pro: Create a field and apply a domain and default value for instructions. For Data Type, ensure Double is selected.
  2. Repeat the steps for another layer. In this example, the new field in LAYER_1 is BridgeDistance, and the new field in LAYER_2 is ToCalculate.
The Fields view tab for LAYER_1.
The Fields view tab for LAYER_2.
  1. On the ArcGIS Pro ribbon, on the Fields tab, click Save.
The Fields tab on the ArcGIS Pro ribbon to save the modifications.
  1. Remove unwanted vertices from the polyline feature.
    1. In the Contents pane, uncheck LAYER_1 to turn off visibility, and ensure LAYER_2 is selected.
The Contents pane featuring the Uncheck the box to turn off visibility  option for the layers.
  1. On the ArcGIS Pro ribbon, on the Edit tab, click Edit Vertices.
The ArcGIS Pro ribbon containing the Edit Vertices option from the Editor tool gallery.
  1. Select the polyline feature, and delete the unwanted vertices. Refer to ArcGIS Pro: Edit vertices with the pointer for instructions.
  2. On the Edit tab, click Save to save the modifications to the polyline feature.
The map with the bridge over the Blackfriars Underpass, London containing the two vertices symbolized with a red color line.
  1. Calculate the distance between the vertices using the Calculate Geometry Attributes tool.
    1. In the Contents pane, right-click LAYER_2, and click Attribute Table.
    2. Right-click the ToCalculate field, and click Calculate Geometry.
    3. In the Calculate Geometry window, under Geometry Property, for Property, click the drop-down arrow, and select Length (geodesic).
    4. For Length Unit, click the drop-down arrow, and select the preferred unit of measurement.
    5. Click OK. The output of the tool is populated in the ToCalculate field.
The parameters in the Calculate Geometry window.
The attribute table for LAYER_2.
  1. Perform a join between the two tables using the Add Join tool.
    1. In the Contents pane, right-click LAYER_1, and click Joins and Relates > Add Join.
    2. In the Add Join window, for Input Join Field, click the drop-down arrow, and select OBJECTID.
    3. For Join Table, click the drop-down arrow, and select LAYER_2.
    4. For Join Table Field, click the drop-down arrow, and select OBJECTID.
    5. Click OK.
The Add Join window with the parameters for the Input Join Field, Join Table, and Join Table Field.
  1. Use the Calculate Field tool to transfer the output data to LAYER_1.
    1. In the Contents pane, right-click LAYER_1, and click Attribute Table.
    2. In the table view, right-click the new field, BridgeDistance, and click Calculate Field.
    3. In the Calculate Field window, double-click the ToCalculate field in Fields to add the field name to the expression box.
    4. Click OK.
The Calculate Field window.
  1. Remove the join between LAYER_1 and LAYER_2.
    1. In the Contents pane, right-click LAYER_1, and click Joins and Relates > Remove All Joins.
The Content pane with all the joins in the map layer.
  1. In the Remove Joins dialog box, click Yes.
The Remove Joins dialog box.

The distance between the specific vertices of the bridge is populated in the source layer.

The attribute table for LAYER_1 with the result of the Calculate Geometry tool copied to the BridgeDistance field from the ToCalculate field in LAYER_2.

Article ID: 000025382

Software:
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 x

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