Summary
In ArcGIS Pro, sometimes when line features intersect with a polygon feature, only a certain percentage of the line features fall within the polygon. Calculating the percentage of the line features that fall within the polygon identifies the area covered, which is useful to avoid extra segments on the map or for spatial analysis.
This article provides two workflows to calculate the percentage of lines within the polygon.
Procedure
Use the Tabulate Intersection tool
Note:
This tool requires the ArcGIS Pro Advanced license.
In this workflow, the tool calculates the total percentage of all the lines that fall within the polygon and displays it in a new standalone table.
- Open the ArcGIS Pro project.
- Navigate to the Analysis tab and click Tools. The Geoprocessing pane opens.
- In the Geoprocessing pane, search for and select the Tabulate Intersection tool.
- On the Tabulate Intersection pane, configure the parameters of the tool.
- For Input Zone Features, select the polygon feature layer.
- For Zone Fields, click the drop-down menu and select the Shape_Length field.
- For Input Class Features, select the line feature layer.
- Leave all the other parameters as default. Click Run.
The image below displays the PERCENTAGE field in a table displaying the total percentage of all the lines that fall within the polygon.
Manually calculate the percentage using the Calculate Field tool
Using this workflow, the percentage of lines that fall within the polygon is calculated individually and displayed in the attribute table of a new output feature layer.
- Open the ArcGIS Pro project.
- Add a new field to the line feature layer.
- In the Contents pane, right-click the line feature layer and click Data Design > Fields.
- Create a new numeric field type on the line feature layer to copy the values of the Shape_Length field. In this example, the new field is named F_Shape_Length and the data type is Double.
- In the attribute table of the line feature layer, copy and paste the Shape_Length values of the line feature layer to the field created in Step 2. Refer to How To: Copy field values to another field in ArcGIS Pro for instructions.
- Intersect the line and polygon feature layers using the Intersect tool.
- Navigate to the Analysis tab and click Tools. The Geoprocessing pane opens.
- In the Geoprocessing pane, search and select the Intersect tool.
- For Input Features, click the drop-down menu and select both the polygon and line features to have two input features.
- Leave all other parameters as default. Click Run.
- Add a new field to the new feature layer created in Step 4.
- In the Contents pane, right-click the new feature layer and click Data Design > Fields.
- Create a new numeric field type in the fields view. In this example, the new field is named Percentage and the data type is Double.
- Calculate the percentage of the line features that fall within the polygon in the new field.
- In the attribute table of the new feature layer, right-click the field name created in Step 5, and select Calculate Field.
- In the Calculate Field window, for Input Table, ensure the feature layer from Step 4 is selected.
- For Field Name, ensure the field created in Step 5 is selected. In this example, the field name is Percentage.
- For Expression Type, select Arcade.
- For Expression, specify the code provided below. Replace <field_name> with the name of the field created in Step 2. In this example, F_Shape_Length is used.
($feature.Shape_Length/$feature.<field_name>)*100
- Click the Verify icon to validate the expression.
- Click OK to run the script.
The image below displays the Percentage field in the attribute table, displaying the individual percentage of the lines that fall within the polygon.