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.
Procedure
- Open the ArcGIS Pro project.
- Intersect the line and polygon feature layers using the Intersect tool.
- 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.
- 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.
- Provide a name for Output Feature Class, and click Browse.... to specify the location for the output feature class.
- Select All attributes for Attributes To Join.
- Select Line for Output Type.
- Click Run. The new feature class created by the Intersect tool is automatically added to the map.
- Add a new field to the attribute table of the feature class created from the Intersect tool.
- In the Contents pane, right-click the layer and select Attribute Table.
- In the attribute table, click Add Field. The Fields view opens.
- 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.
- Double-click the Alias column of the new field and specify an alias for it. In this example, the alias is River_Length.
- Double-click the Data Type column of the new field and select Double from the drop-down menu.
- On the top ribbon, on the Fields tab, click Save.
- Populate the spatial information for the field using the Calculate Geometry tool.
- Right-click the field header in the attribute table and select Calculate Geometry to open the Calculate Geometry window.
- 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.
- Select the unit of measurement for Length Unit. In this example, Meters is selected.
- Select Current Map [Map] from the Coordinate System drop-down list.
- Click OK.
- Summarize the field using the Summary Statistics tool to calculate the total length of the lines.
- Right-click the field header in the attribute table and select Summarize to open the Summary Statistics window.
- In the Summary Statistics window, select the feature layer from the Input Table drop-down list. In this example, RiversIntersect is selected.
- Provide a name for Output Table, and click Browse.... to specify the location for the output table. In this example, the output table is RiversIntersect_Statistics.
- In the Statistics Field(s) section, select the field for Field, and Sum for Statistic Type. In this example, River_Length is selected.
- 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.
- Click OK. A table created by the Summary Statistics tool is automatically added to the Contents pane.
- In the Contents pane, right-click the output table and select Open.
The image below shows the SUM_River_Length field in the table indicating the total length of lines within the polygon in ArcGIS Pro.