4

I have a parcel polygon feature where some of the polygons have been duplicated over time. I could run the Delete Identical tool to remove all duplicates, however, some of the polygons have data in a field that I would like to retain and I don't want the tool to delete that one.

Is there a way to delete the duplicate polygons while retaining the one with a certain attribute field value?

2
  • Is it ever the case that polygonA and polygonB are duplicates of each other and neither have data in the field of interest? If it is, I assume you'd want to keep one of them, right?
    – alaybourn
    Commented Jul 7, 2017 at 14:14
  • Correct. Many duplicated polygons do not have any data in the field of interest, but I still want to keep one of them.
    – Andrew B
    Commented Jul 11, 2017 at 16:16

3 Answers 3

3

Geo-processing tools honour selections, so why not have some pre-logic that selects up the polygons you want to delete? Un-selected polygons would be ignored. Before you start going down that road as it is easy to mess up selections if you are not paying attention (we've all done it) I would make a backup copy of your dataset.

An alternative method is to add a flag field to your dataset and populate that with values and then use that as the basis of a select and delete.

3

If you don't have many data @hornbydd 's method would work faster. In the case of having loads of data: I would add x,y coordinates(for defining repeating data, or use attributes you have), then convert to excel table with table to excel tool. Then, remove repeating data and join the filtered table to Arcmap with matching records only. I think table to excel tool able to convert up to 53,000 of features.

1

If you're up for a little scripting in the Python window you could first run the Find Identical tool under Data Management->General that creates a table with a field that assigns duplicate sets, then run the code below and finally delete (by selection as mentioned in above answers) rows that are flagged as duplicates and have no information in the attribute field of interest. You'll have to create an is_dup field in your polygon file as a short integer.

#assign variables of polygon and table from Find Identical tool output
my_shp = 'test_poly.shp'
my_tbl = 'test_poly_FindIdentical1.dbf'

#create count of each feature sequence from Find Identical table 
recordHist={}
with arcpy.da.SearchCursor(my_tbl, ["IN_FID", "FEAT_SEQ"]) as rows:
    for row in rows:
        recordHist[row[1]]=recordHist.get(row[1], 0) + 1

#assign FIDs as dup or not (sequences with count>1 are duplicates)
idDupHist={}
with arcpy.da.SearchCursor(my_tbl, ["IN_FID", "FEAT_SEQ"]) as rows:
    for row in rows:
        if recordHist[row[1]]>1:
            idDupHist[row[0]]='Y'
        else:
            idDupHist[row[0]]='N'

#update shape file
with arcpy.da.UpdateCursor(my_shp, ["FID","is_dup"]) as rows:
    for row in rows:
        if idDupHist[row[0]]=="Y":
            row[1]=1
        else:
            row[1]=0
        rows.updateRow(row)  

Your Answer

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

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