What process can I use to remove isolated cells in my layer; i.e. cells that don't have an immediate neighbour are to be removed - I've circled a couple in the image below. These are based on an index within a table built with the fishnet tool. Many of the cells for the index column in the attribute table are blank.

enter image description hereenter image description here

  • 1
    If you have access to spatial analyst extension you could use a Con with FocalStatistics (SUM) of an IsNull raster < 8 like: arcpy.sa.Con(arcpy.sa.FocalStatistics(arcpy.sa.IsNull(YourRaster),arcpy.sa.NbrRectangle(3,3,'CELL'),'SUM') < 8, YourRaster). If your data is feature data then look at Polygon Neighbors resources.arcgis.com/en/help/main/10.2/index.html#//… - polygons with no adjacent polygons don't appear in the output table (advanced license required). Commented Jun 27, 2018 at 5:50
  • 1
    Are you trying to do this within ArcMap or within ArcGIS Pro? If it is both then please just ask about one here and about the other in a separate question. That way you can tell us precisely what you have tried, and where you are stuck, in each.
    – PolyGeo
    Commented Jun 27, 2018 at 6:05
  • If it is vector data use Select tool and select those with a Shape Area > the area of one cell.
    – Bera
    Commented Jun 27, 2018 at 10:20
  • @BERA: all cells are a separate row - therefore all have the same area and this doesn't work.
    – val
    Commented Jun 27, 2018 at 10:55
  • @MichaelStimson: I'm trying the Polygon Neighbour tool. It creates a table but how do I use the values in that table to filter my layer? It works but I'm left with a table that has no spatial features.
    – val
    Commented Jun 27, 2018 at 10:56

3 Answers 3


If you are working with a vector dataset and you want to identify the polygons that have no neighbours so to remove them this can be easily done without any code, you could wrap it up in a model if you are automating this in the future.

  1. Run the Polygons Neighbors tools making sure the reporting field is an unique ID field, such as OBJECTID or FID. This will create a table for all polygons that share a boundary with at least one other neighbouring polygon.


  1. Now create a relate between this table and the polygon Featureclass as shown below (note you are relating src_OBJECTID in table to OBJECTID in FeatureClass):


  1. Select all rows in the table.
  2. Run the relate and pass the selection back to the polygon Featureclass.
  3. Invert the selection.

Ready to delete

  1. Delete isolated polygons, you could use the Delete Features tool for that as that honours selections.

You can use Python. For each cell, check that no other cell share a vertice:

import arcpy
from collections import defaultdict

layer = "fishnet"

#Create a dictionary of each vertice as key, and a list of all objectids at that vertice as value
d = defaultdict(list)
oids = []
with arcpy.da.SearchCursor(layer,['OID@','SHAPE@']) as cursor:
    for oid, shape in cursor:
        for vertices in shape:
            for vertice in vertices[:-1]:

#For each objectid check that they dont share vertices with another objectid
loners = []
for o in oids:
    c = 0
    #for k,v in d.items(): #py3/ArcGIS Pro
    for k,v in d.iteritems(): #py2/ArcMap
        if o[0] in v:
    if c < o[1]:

sql = """{0} IN({1})""".format(arcpy.AddFieldDelimiters(layer,arcpy.Describe(layer).OIDFieldname),','.join(str(o) for o in loners))

Lonely cells get selected: enter image description here


It seems to me that you are dealing with vector dataset so Select Layer by Location tool should do the trick.

  • Could you add more details. What should be used for Selection Features etc.?
    – Bera
    Commented Jun 27, 2018 at 10:21
  • @Alesinar: I'm looking for a functional method - not selecting things by hand. Sorry if that was not explicitly in the OP.
    – val
    Commented Jun 27, 2018 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.