My question is similar to Calculating edge length of polygon within overlapping polygon using ArcGIS Desktop?

However, my issue differs in that I have multiple overlapping polygons (upwards of 7) that share the same line.

Here's an example:


Polygons represent 50 meter buffers around a point and the line represents the edge of another polygon that I've clipped.

I'm trying to calculate the length of the blue line contained within multiple (yellow) polygons. The issue I'm running into is that I'm not able to calculate the length of the line within each individual polygon. I've tried Spatial Join and Intersect which haven't worked. Spatial Join results in the total length of the line regardless of polygon. Intersect segments the line by polygon border, therefore cutting off portions that should be included within a given polygon, i.e. length isn't calculated for a polygon that is overlapped.

I am using ArcGIS Desktop 10.6.

  • Use dissolve or summary statistics (case field is polygon id) after intersect. Such basic tasks to be solved using tools available. Scripting is last resource.
    – FelixIP
    Feb 15, 2019 at 20:15

2 Answers 2


You can use arcpy and the da.UpdateCursor to iterate over each polygon and intersect with a dissolved line feature class, calculate length and write to a new field in the polygon feature class. Look at the documentation for Polygon and Polyline objects to understand disjoint, intersect etc.

import arcpy
polyfc = r'points_Buffer300m' #Name of polygon layer
linefc = r'line' #Name of line layer
linelength_field = 'linelen' #Name of field to hold lengths. Will be added below

arcpy.AddField_management(in_table=polyfc, field_name=linelength_field, field_type='DOUBLE')
arcpy.Dissolve_management(in_features=linefc, out_feature_class=r'in_memory\diss')
linegeometry = [i[0] for i in arcpy.da.SearchCursor(r'in_memory\diss','SHAPE@')][0]

with arcpy.da.UpdateCursor(polyfc,['SHAPE@',linelength_field]) as cursor: #Iterate over each polygon
    for row in cursor:
        if not linegeometry.disjoint(row[0]): #Check if polygon intersects polyline
            row[1]=linegeometry.intersect(row[0],2).length #Intersect the dissolved line geometry with polygon and calculate length of output line
            row[1] = 0

enter image description here

  • 1
    @mwbarnes nice! Please accept my answer with the checkbox
    – BERA
    Feb 15, 2019 at 20:00

In the picture below length of each line equal 100 m and radius of each circle is 75 m:

enter image description here

I intersected lines and circles and dissolve result using polygon id (NAME) as case field. As expected total length of lines equals to 150 m within each polygon: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.