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.
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.
- 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.
- 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.
- Add a new field to LAYER_1 and LAYER_2.
- In the Contents pane, right-click one of the layers, and click Design > Fields.
- 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.
- 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.
- On the ArcGIS Pro ribbon, on the Fields tab, click Save.
- Remove unwanted vertices from the polyline feature.
- In the Contents pane, uncheck LAYER_1 to turn off visibility, and ensure LAYER_2 is selected.
- On the ArcGIS Pro ribbon, on the Edit tab, click Edit Vertices.
- Select the polyline feature, and delete the unwanted vertices. Refer to ArcGIS Pro: Edit vertices with the pointer for instructions.
- On the Edit tab, click Save to save the modifications to the polyline feature.
- Calculate the distance between the vertices using the Calculate Geometry Attributes tool.
- In the Contents pane, right-click LAYER_2, and click Attribute Table.
- Right-click the ToCalculate field, and click Calculate Geometry.
- In the Calculate Geometry window, under Geometry Property, for Property, click the drop-down arrow, and select Length (geodesic).
- For Length Unit, click the drop-down arrow, and select the preferred unit of measurement.
- Click OK. The output of the tool is populated in the ToCalculate field.
- Perform a join between the two tables using the Add Join tool.
- In the Contents pane, right-click LAYER_1, and click Joins and Relates > Add Join.
- In the Add Join window, for Input Join Field, click the drop-down arrow, and select OBJECTID.
- For Join Table, click the drop-down arrow, and select LAYER_2.
- For Join Table Field, click the drop-down arrow, and select OBJECTID.
- Click OK.
- Use the Calculate Field tool to transfer the output data to LAYER_1.
- In the Contents pane, right-click LAYER_1, and click Attribute Table.
- In the table view, right-click the new field, BridgeDistance, and click Calculate Field.
- In the Calculate Field window, double-click the ToCalculate field in Fields to add the field name to the expression box.
- Click OK.
- Remove the join between LAYER_1 and LAYER_2.
- In the Contents pane, right-click LAYER_1, and click Joins and Relates > Remove All Joins.
- In the Remove Joins dialog box, click Yes.
The distance between the specific vertices of the bridge is populated in the source layer.