I'm in ArcGIS Pro environment and for this case a simple Intersect tool is not enough, so I'm trying some Python scripting.

Below is the rectangles and the circle buffers that I need their pair intersections.

enter image description here

The second image below is how I do NOT want my intersections. This is just a normal Intersection Tool result.

enter image description here

And the third image below is the way I would like to get all the intersections.

enter image description here

I'm really new at programming and Python. I've done some tries and until now here is what I have:

import arcpy

arcpy.env.workspace = 'Workspace'    
blocos = 'rectangles'    
buffers = 'circle_Buffers'    
out_fc_intersect = []

with arcpy.da.SearchCursor(blocos, 'SHAPE@') as cursor_blocos:    
    for row_blocos in cursor_blocos:    
        with arcpy.da.SearchCursor(buffer, 'SHAPE@') as cursor_buffer:    
            for row_buffer in cursor_buffer:    
                arcpy.Intersect_analysis([cursor_blocos, cursor_buffer], out_fc_intersect_SC[])

I tried using SearchCursors to walk through the feature classes records (rectangles and circles) so I could use these cursors to intersect each feature separately. I think I'm in the right way, but I don't know how to save and assemble again all the separated intersections of each pair.

  • In the third picture, are the rectangle and circle overlapping?
    – BERA
    Sep 14, 2021 at 18:33
  • 1
    Yes. The circles are overlapping the rectangles.
    – Gustavo M.
    Sep 14, 2021 at 18:47
  • 1
    I tried using Union but there is no common attribute that corresponds just to the area of my interest for me to select by attributes.
    – Gustavo M.
    Sep 14, 2021 at 18:49

2 Answers 2


This is the case when scripting is massive overkill, because:

arcpy.Intersect_analysis("buffer #;fish_net #","in_memory/isect", "ONLY_FID")
arcpy.Dissolve_management("isect", "in_memory/dissolve", dissolve_field="FID_fish_net")

Does the job in no time:

enter image description here

  • 2
    Agree, any scripting approach is overkill, its worth stating that the trick in this succinct 2 step approach is that the dissolve is grouping by the grid cell id, so any overlapping geometries caused by the intersection when the circle is bigger than the square are resolved because they both fall within the square and get a square ID which can be used to dissolve on.
    – Hornbydd
    Sep 14, 2021 at 23:42

This should work - it finds the polygon that intersects with the buffer centroid, and finds the intersection only of the polygon that contains the buffer centroid. Not tested. Please note that this will modify your data in place, so make a copy.

import arcpy

polygon_geom_list = []

buffers = r'C:\path_to_your_buffer_layer'
polys = r'C:\path_to_your_polygon_layer'

buffers = arcpy.mapping.Layer(buffers)
polys = arcpy.mapping.Layer(polys)

# Create list of geometries from the polygons
with arcpy.da.SearchCursor(polys,["SHAPE@"]) as ecur:
    for e in ecur:
del ecur

# Test if polygons intersect the buffer centroids and if so, run the intersection for the buffer and polygon
for e in polygon_geom_list:
    with arcpy.da.UpdateCursor(buffers, ["SHAPE@"]) as buffers:
        for buffer in buffers:
            if e.contains(buffer[0].centroid)==True:
del buffers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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