HOW TO

Calculate the percentage of line features within a polygon in ArcGIS Pro

Last Published: September 19, 2023

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.

Intersecting lines and polygon features.png

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.

  1. Open the ArcGIS Pro project.
  2. Navigate to the Analysis tab and click Tools. The Geoprocessing pane opens.
  3. In the Geoprocessing pane, search for and select the Tabulate Intersection tool.
  4. On the Tabulate Intersection pane, configure the parameters of the tool.
    1. For Input Zone Features, select the polygon feature layer.
    2. For Zone Fields, click the drop-down menu and select the Shape_Length field.
    3. For Input Class Features, select the line feature layer.
    4. 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.

Table displaying the total percentage of all the lines that fall within the polygon.png

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.

  1. Open the ArcGIS Pro project.
  2. Add a new field to the line feature layer.
    1. In the Contents pane, right-click the line feature layer and click Data Design > Fields.
    2. 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.
Fields view of the newly created field for the line feature layer.png
  1. 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.
  2. Intersect the line and polygon feature layers using the Intersect tool.
    1. Navigate to the Analysis tab and click Tools. The Geoprocessing pane opens.
    2. In the Geoprocessing pane, search and select the Intersect tool.
    3. For Input Features, click the drop-down menu and select both the polygon and line features to have two input features.
    4. Leave all other parameters as default. Click Run.
  3. Add a new field to the new feature layer created in Step 4.
    1. In the Contents pane, right-click the new feature layer and click Data Design > Fields.
    2. 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.
Fields view of the newly created field on the new feature layer.png
  1. Calculate the percentage of the line features that fall within the polygon in the new field.
    1. In the attribute table of the new feature layer, right-click the field name created in Step 5, and select Calculate Field.
    2. In the Calculate Field window, for Input Table, ensure the feature layer from Step 4 is selected.
    3. For Field Name, ensure the field created in Step 5 is selected. In this example, the field name is Percentage.
    4. For Expression Type, select Arcade.
    5. 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
  1. Click the Verify icon to validate the expression.
  2. Click OK to run the script.
Calculate field window configuration.png

The image below displays the Percentage field in the attribute table, displaying the individual percentage of the lines that fall within the polygon.

Table containing the individual percentage of lines that fall within the polygon.png

Article ID: 000031060

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 9x

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