0

I have a polygon shapefile, in which there are many duplicate records (duplicate in the spatial sense, but with different attributes). What I want to do is merge all features that have the exact same geometry but keep the attributes from all of the polygons. Is this possible to do?

For an example, if I had the following as an input and all three features has the same geometry.

enter image description here

Then I want something like this at the end

enter image description here

  • You might be able to get it by using the Find Identical tool (using Shape as the Field value) followed by the Pivot Table tool. – Bjorn Jun 9 '17 at 21:03
  • Sadly I'm only running Basic so no Find Identical tool – rockycove Jun 9 '17 at 21:15
  • Have you tested Dissolve? I think it will merge stacked polygons that have identical attributes into one polygon. – klewis Jun 9 '17 at 22:03
1

The key here is creation of what I call digital signature of the shape:

arcpy.AddField_management("POLYGONS", "SIGNATURE", "TEXT")
arcpy.CalculateField_management("POLYGONS", "SIGNATURE","str(!Shape!.centroid.X)+str(!Shape!.centroid.Y)")
arcpy.AddField_management("POLYGONS", "COMBO","TEXT")
# run this on combo field
aDict={}
def Combine(a,b):
 if a in aDict:  aDict[a]+=[b]
 else: aDict[a]=[b]
 return ";".join(aDict[a])
#--------------------
Combine( !SIGNATURE!, !INFO! )
# and dissolve
arcpy.Dissolve_management("POLYGONS","../dissolved.shp", "SIGNATURE", "COMBO LAST")

enter image description here

I hope the rest is obvious

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.