Is there any way to dissolve shapefile but keep attributes fields in the same time?

This is how I want to retain fields:

There are two fields I want to conserve in a shapefile. The first column is Net_ID with long type, and the second column is Geology with string type.

I would like to dissolve the shapefile using field NET_ID. Besides, I would like to keep the Geology field, like the below figure.

enter image description here

  • 1
    Just run the dissolve tool! Dissolve by would be your ID field and then you can join the attributes back from your source dataset. Look at the help file for the dissolve tool. – Hornbydd Aug 28 '15 at 10:23
  • Lists are non-relational - there are few relational tools to compile them. Dissolve will not concatenate non-dissolve fields -- you will need to compile that programmatically. – Vince Aug 28 '15 at 11:08
  • How to compile them programmatically? Do you mean by using Python to fill in the new Geology field? I really hope that I could know how to do it by program. – NewHere Aug 30 '15 at 7:06

You just need to split it into 2 steps:

  1. Dissolve on the NET_ID
  2. Spatial Join the dissolved layer to the original layer. Use the match type of CONTAINS and set the Merge Rule of the Geology field to Join and set the delimiter to a comma. Right click on the field in the field mapping list and select properties to get to the merge rule and delimiter settings

I have done a similar code to dissolve fields in ArcGIS Pro but you can use script ArcPy in toolbox and use it also in ArcGIS Desktop. You can download from github: DissolveFields

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.