Deleting Features From One Layer Based On Geometry Of Another Layer

78
1
12-27-2018 07:34 AM
AndrewSouthern
Occasional Contributor

I have two layers and would like to script either a delete or erase to remove features from Layer #1 based on the geometry or an attribute from Layer #2.  Features in both layers share the same location and common id field (features created in Layer #2 are created using a custom URL scheme for Survey123 and pulls the same location and id attribute from Layer #1.)  Can someone please point me in the right direction.  In my mind there should be a way for me to run something like the erase geoprocessing tool and erase all features from Layer #1 that intersect Layer #2.  Or delete features using a comma separated list based off the common id field although I'm not sure that this module will run on a list based on anything other than ObjectID, though I could be wrong.

Any help is appreciated.  I've been attempting to figure this out for days without much luck and have exhausted the reference looking for answers (I wish there were more example snippets in the reference for Python novices like myself.)

Thank you.

0 Kudos
1 Reply
RhettZufelt
MVP Frequent Contributor

why can't you use the Erase geoprocessing tool (accessed with arcpy)?

also, DeleteFeatures should do this for you as well.

R_

0 Kudos