Combine touching polygons, keeping all attributes from Class ‘A’ feature

clip_image001How to automatically merge polygons sharing a common boundary, keeping all attributes from class “A” features?

Interactively I would do this in an edit session by:

  • selecting all objects of Name “One”,
  • Editor toolbar >> Merge,
  • choose Class “A” to be the parent/master feature.

Repeat for features of Name “Two”, “Three”, …

Dissolve doesn’t work because we need to keep other attributes which differ. In other words, we need to:

  • Dissolve/merge touching polygons where geometry [Name] is identical
  • Keep attributes from polygon with [Class] A (if multiple Class A’s, ok to just keep first one)
  • Discard attributes from other features



Dissolve does work, just not on it’s own. Spatial Join as well, but it too is insufficient on it’s own. I had explored and rejected both of these earlier because of of losing wanted attributes altogether (Dissolve) or resulting nulls in the attributes I need to keep (Spatial Join). With @Richard’s answer we’re reoriented properly. The solution:

  1. Dissolve on the common field, Name. We lose all other attributes but that’s ok as it’s only the geometry we’ll keep from this step.
  2. Collect the attributes we want and make them portable with Make Feature Layer (or a Definition Query or interactive selection or …) and Feature to Points. Make sure to select INSIDE so the points are always inside the polygons.
  3. Transfer the attributes from the points to the empty polygons with Spatial Join, use Match Option CLOSEST. One to one and One to Many don’t seem to differ for the data I’m working with.

gp model

Expressed in arcpy:

# original feature class: border_lakes
# final feature class: dissolved_border_lakes_with_attributes
# all others can be discarded (tip: use "in_memory" workspace)

dissolve_field="Name", statistics_fields="",

where_clause="Class LIKE 'A'")




clip_image004Spatial Join in step 3 is where I went wrong at first and ended up with null attributes or other unwanted combinations. I was choosing HAVE_THEIR_CENTER_IN and WITHIN. It was the interactive Spatial Join from the ArcMap table of contents, with it’s different wording from the geoprocessing tool, that gave me the final clue.

I suspect it possible to use spatial join without using the point file intermediary, but wasn’t successful with our data. Having something that works is good enough for now; I’ll leave further optimization for others.


For further information and possible alternatives see



  • Can you help me please!
    How to combine objects according to attribute fields whose output Area field is equal to the input? (Output Featue class must not have multi part geometries.)
    With Area field is decimal
    My data file and workflow are attached below:

    • Sorry for the long delay in replying. I didn’t get notification of your comment. If this challenge is still relevant to you ask this on where a lot more people will see it and you’ve a better chance of a getting good and useful answers.

      I looked at your data and replicated your results. Notice that in the output dissolved feature class the values of SUM_AREA and Shape_Area for each record do not match. This suggests that the source Area attribute is in different units, e.g. hectares instead of square meters or kilometers.


Leave a Reply

Your email address will not be published. Required fields are marked *