I am looking for a way to remove part of a polygon that overlaps with a polygon in another layer.
Specifically I have two datasets, one is a set of square polygons and the other is a set of convex hull polygons which originates from each square polygon. I now need to remove from each convex hull that part which intersects with the square it originates from. The part of the convex hull not within the originating square should remain intact as it will be dealt with in a subsequent process.

The square polygons, each is used to create a convex hull. Square polygons The convex hulls. The only part to erase is the circular area within each square. Need to remove only the circular part within the originating square This is my result from Model Builder. Correctly removed part within the square but only one, I need over 50,000 removed. This is my result from Model Builder. Correctly removed part within the square but only one, I need over 50,000 removed. Any help improving this Model or do I need a different approach? EraseModel

  • Have you looked at pro.arcgis.com/en/pro-app/tool-reference/analysis/… ? You'll still need to post process that, but you aren't running 50k erases
    – Paul
    Aug 21 '18 at 0:50
  • Thanks for the suggestion. Had a quick look and attempt but it sort of does the opposite of what I require. The Pairwise intersection appears to only retain the intersecting areas and I want to remove the intersecting areas.
    – Arbor
    Aug 21 '18 at 1:52
  • Looking at the screen shot of your model why is it only doing just one? If you have 50K hulls in hull_sample then the model should run 50K times? The logic looks sound, I don't understand why it has only run once?
    – Hornbydd
    Aug 21 '18 at 9:09
  • I do not know why it only runs once, there are no errors and no messages. Either I am doing something wrong or it is another bug in the software. I have not tried reproducing the model ArcGIS Pro, I may attempt it later. If it works in Pro that would reinforce the bug theory.
    – Arbor
    Aug 21 '18 at 20:39

Perhaps run this calculator expression on field Shape of your target:

def getSegment(ID):
 f = arcpy.AddFieldDelimiters("HULLS","LABEL")
 q="%s='%s'" %(f,ID)
 with arcpy.da.SearchCursor("HULLS", 'Shape@',q) as cursor:
  for row in cursor:  pair=row[0]
 with arcpy.da.SearchCursor("TARGET", 'Shape@',q) as cursor:
  for row in cursor:  shp=row[0]
 m=shp.difference (pair)
 return m
getSegment( !Label! )


enter image description here


enter image description here

Python expression above assumes:

  • your target layer is stored as shapefile and named "TARGET" in the table of current mxd.
  • eraser layer stored as shapefile and named "HULLS" in the table of current mxd.
  • Common field in both layers is text field called "Label". If this not a case create such field in both and populate them from existing common fields.

NOTE: script modifies shapes in existing target layer, so create backup copy first.

First learn how to use advanced field calculator in arcgis.

  • I was not able to duplicate this, could be my lack of programming skills.
    – Arbor
    Aug 21 '18 at 23:34
  • Was this ArcGIS Desktop or ArcGIS Pro? And what programming language?
    – Arbor
    Aug 21 '18 at 23:35
  • I'll extend my answer soon.
    – FelixIP
    Aug 21 '18 at 23:50
  • See updated answer.
    – FelixIP
    Aug 22 '18 at 1:22
  • My Python is a bit rusty, after going over my previous attempt I omitted one small thing. I am now able to reproduce your expression successfully. I had to reverse it a bit to get the results I need but it works. One small problem is that after successfully completing this expression and saving the result, ArcGIS crashes. Not a major problem I only need to run this once a week at most. Thanks for the help, it would have taken me ages to work it out.
    – Arbor
    Aug 22 '18 at 2:24

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.