HOW TO

Calculate the total length of lines within a polygon in ArcGIS Pro

Last Published: July 20, 2023

Summary

It is sometimes necessary to calculate the total length of lines within a polygon to perform spatial analysis for an area in a map. For example, the extent of the rivers for water quality analysis, the length of the rivers within an area, or the distance between rivers for gold exploration and investigation.

In this article, the total length of the rivers within a polygon layer named Village A is calculated in ArcGIS Pro.

Map of the line layer of rivers within the square polygon layer named Village A.

Procedure

  1. Open the ArcGIS Pro project.
  2. Intersect the line and polygon feature layers using the Intersect tool.
    1. In the Geoprocessing pane, search for and click the Intersect tool. Refer to ArcGIS Pro: Run a tool in the Geoprocessing pane for steps to do this.
    2. In the Intersect pane, under the Parameters tab, select the line and polygon feature layers from the Input Features drop-down list. In this example, Village A and Rivers are selected.
    3. Provide a name for Output Feature Class, and click Browse.... The Browse icon. to specify the location for the output feature class.
    4. Select All attributes for Attributes To Join.
    5. Select Line for Output Type.
    6. Click Run. The new feature class created by the Intersect tool is automatically added to the map.
The two tabs under the Intersect pane, which are Parameters and Environments.
  1. Add a new field to the attribute table of the feature class created from the Intersect tool.
    1. In the Contents pane, right-click the layer and select Attribute Table.
The layers in the Contents pane.
  1. In the attribute table, click Add FieldThe Add Field icon.. The Fields view opens.
  2. In the Fields view, specify a name for the field in the Field Name column. In this example, the new field name is River_Length.
  3. Double-click the Alias column of the new field and specify an alias for it. In this example, the alias is River_Length.
  4. Double-click the Data Type column of the new field and select Double from the drop-down menu.
The Fields view, RiverIntersect, consisting of several columns for data editing.
  1. On the top ribbon, on the Fields tab, click Save.
The Fields tab with the Changes group consisting of two selections, New Field and Save.
  1. Populate the spatial information for the field using the Calculate Geometry tool.
    1. Right-click the field header in the attribute table and select Calculate Geometry to open the Calculate Geometry window.
The feature layer attribute table, RiversIntersect, with several fields including the new field created.
  1. In the Calculate Geometry window, select the field for Target Field, and Length (geodesic) for Property in the Geometry Property section. In this example, River_Length is selected.
  2. Select the unit of measurement for Length Unit. In this example, Meters is selected.
  3. Select Current Map [Map] from the Coordinate System drop-down list.
  4. Click OK.
The Calculate Geometry window with the note stating that the tool modifies the input data.
  1. Summarize the field using the Summary Statistics tool to calculate the total length of the lines.
    1. Right-click the field header in the attribute table and select Summarize to open the Summary Statistics window.
The feature layer attribute table, RiversIntersect, with several fields including the new field created.
  1. In the Summary Statistics window, select the feature layer from the Input Table drop-down list. In this example, RiversIntersect is selected.
  2. Provide a name for Output Table, and click Browse.... The Browse icon. to specify the location for the output table. In this example, the output table is RiversIntersect_Statistics.
  3. In the Statistics Field(s) section, select the field for Field, and Sum for Statistic Type. In this example, River_Length is selected.
  4. Select the polygon field for Case field. In this example, Village A is selected.
Note:
If there is more than one polygon, select the field for Case Field to calculate the sum separately for each unique polygon. The Output Table contains only one record if no Case field is specified. So if one is specified, there is one record for each Case field value.
  1. Click OK. A table created by the Summary Statistics tool is automatically added to the Contents pane.
The Summary Statistics window with the Input Table, Output Table, Statistics Fields, and Case field parameters.
  1. In the Contents pane, right-click the output table and select Open.
The new table created added in the Contents pane.

The image below shows the SUM_River_Length field in the table indicating the total length of lines within the polygon in ArcGIS Pro.

The new table created, SUM_River_Length, indicating the total length of lines within the polygon.

Article ID: 000025203

Software:
  • ArcGIS Pro 2 7 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