Tool/Python Script to Analyze Adjacent Polygons

691
2
02-11-2013 08:48 AM
MikeMacRae
Occasional Contributor III
Hey everyone,

I have a large polygon set and I want to be able to do some sort of spatial analysis to determine if adjacent polygons contain the same attribute value from one field in the attribute table (i.e. I have a field called SOIL_TYPE. If 2 adjacent polygons both have the the same SOIL_TYPE, they should be flagged and merged as one). I'm thinking there must be a tool/python script that will do this, but I've searched around and haven't com across anything. If anyone can point me in the right direction, I'd appreciate it.

Cheers,
Mike
0 Kudos
2 Replies
RichardFairhurst
MVP Honored Contributor
Hey everyone,

I have a large polygon set and I want to be able to do some sort of spatial analysis to determine if adjacent polygons contain the same attribute value from one field in the attribute table (i.e. I have a field called SOIL_TYPE. If 2 adjacent polygons both have the the same SOIL_TYPE, they should be flagged and merged as one). I'm thinking there must be a tool/python script that will do this, but I've searched around and haven't com across anything. If anyone can point me in the right direction, I'd appreciate it.

Cheers,
Mike


Sounds like you need to use the Dissolve tool to me.  It creates a new output, which could be used to validate the merges and then apply flags to the existing data if that is what you really want to operate on.  Once flagged then some kind of python script could do the merge in te original dataset.
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
if your goal is to merge adjacent polygons by a common attribute, DISSOLVE gives you the result. You need to specify SOIL_TYPE as the Dissolve Field, and uncheck "Create multipart".

If you still need to know which original polygons are merged together, use Select Layer By Location to select original polygons that are IDENTICAL TO dissolved polygons. These are the ones not merged; you can switch the selection now to get the merged ones. Use intersect or Spatial Join tool to intersect this selection with dissolved result to obtain the dissolved polygon IDs as their unique group IDs. Then use Join Field tool to transfer these IDs back to original polygons via OBJECTID and ORIG_FID.

Hope that helps.