1

I have a set of very large shapefiles and would like to merge polygons within these that share one vertex.

Currently they are all separate like so:

enter image description here

What tool can I use to merge all the polygons that share one vertex so in the above example the selected polygon would be part of the one to the left like so:

enter image description here

  • Have you seen this thread Merge adjacent polygons ArcGIS? – Taras May 9 at 8:56
  • I would investigate Polygon Neighbors which I believe can recognize polygons that share one vertex (i.e. are node neighbors). – PolyGeo May 9 at 9:19
  • Convert back to integer raster, region group, to polygons, dissolve to multipart. – FelixIP May 9 at 19:51
  • @FelixIP That worked! Thanks for the help. If you post as an answer I'll accept it. – tom91 May 10 at 10:44
3

Suggestion in my comments "Convert back to integer raster, region group, to polygons, dissolve to multipart" will work for polygons derived from rasters.

However in general it's better to start with suggestion by @Polygeo . You'll need to use script though:

import arcpy
import networkx as nx
##  replace 2 lines below to point to polygons and neighbours table
Nodes=r'C:\SCRATCH\SCRATCH.gdb\R2P'
Links=r'C:\SCRATCH\SCRATCH.gdb\NBRS'
fldFROM,fldTO="src_OBJECTID","nbr_OBJECTID"
G=nx.Graph()
with arcpy.da.SearchCursor(Links, (fldFROM,fldTO)) as cursor:
    for f,t in cursor:
        G.add_edge(int(f),int(t))
d,N=dict(),1
for group in nx.connected_components(G):
    for n in group:d[n]=N
    N+=1
with arcpy.da.UpdateCursor(Nodes, ("OBJECTID","GRP")) as cursor:
    for k, v in cursor:
        if k in d:v=d[k]
        else: N+=1;v=N
        cursor.updateRow((k,v))

Script assumes that your neighborhood table called NBRS, your polygons stored in file GDB and there is a field called "GRP" to store group numbers.

enter image description here

  • Thank you, this worked in my instance, but I'll keep that script in mind too! – tom91 May 13 at 8:12
0

If the polygons are really connected to each other, a Union will merge the neighbors.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 1
    Unfortunately, I've tried Union, including with an xy tolerance but it still produces a shape file where polygons sharing a vertex are separate. They definitely share a vertex because the shape files were made via converting a raster. Is there something else I can try? – tom91 May 9 at 8:52

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.