I am using ArcGIS 10.4 for Desktop.

I have a single feature class with one attribute with 5 levels describing the state of grasslands and how they have changed over time. The attached image shows a piece of this shapefile.

  • Red = "grasslands lost" from 1909-2008 (now forest),
  • light Green = "grasslands retained" that have remained constant,
  • dark green = "grasslands gained"areas that were forest in 1909 but are now grassland in 2008
  • Grey = "forest" areas in 1909 still forested in 2008
  • pale blue = nonvegetated.
  • white = no data

I want to isolate the Grasslands Lost (Red) that are

  1. completely surrounded by Grasslands Retained (light green) (ie like polygons circled in red in picture)
  2. touching forest (grey) (circled in blue)

In both a) and b) it is okay if the red polygons are bordering white (no data). NOTE: there is no overlap of any polygons, they only share edges.

How can I select Red polygons that ONLY have light green or light green+white as neighbours? How can I select Red polygons that have Grey as a neighbour?

enter image description here

  • 1
    if they're in the same feature class and you don't want to code it, then you'll probably need to start by selecting each class and then exporting it to a new feature class or creating a layer from the selected features. Then do a series of selections by location (e.g., select features from red layer that intersect light green; then, remove from the currently selected features those that intersect dark green, and so on).
    – Tom
    Aug 3, 2016 at 22:18
  • That is the approach I have taken so far, I was hoping for something more automated/some sort of tool could do this. I split this into 5 separate feature classes, and then created dummy variables where I check for adjacency of each type using Select By Location where it touches the layer boundary . From this I have a series of binary flag variables so I know if Red touches Light Green or Dark Green or Grey etc. Aug 3, 2016 at 23:17
  • What is your licence level?
    – fatih_dur
    Aug 4, 2016 at 2:57
  • ArcGIS for Desktop (Spatial Analyst, 3D analyst, Geostatistical analyst etc) Aug 4, 2016 at 3:17
  • @ChrisStockdale, have you managed to find a solution to your question. If so, do you mind sharing it?
    – fatih_dur
    Aug 21, 2016 at 2:42

2 Answers 2


I think it can be achieved by Spatial Join tool along with field mapping as exemplified here. Basically you need to transfer desired attribute of all adjoining (this is INTERSECT relationship in Spatial Join) polygons to one (large) TEXT field with a delimiter. After this, a little field calculator expression with Python should give what you are after, say, your delimiter is bar (|) and in a new SHORT field where you will test your conditions, you typed in:

{True:1,False:0}[all([i in ['RED','WHITE','LIGHT GREEN','GREY'] for i in !<CONCATENATED_ATTRIBUTE_FIELD>!.split("|")])]

Please be advised ['RED','WHITE','LIGHT GREEN','GREY'] and CONCATENATED_ATTRIBUTE_FIELD are figurative parameters that you need to supply as to your feature class.


There are indeed many ways to solve this problem, and possibly better ones than the route I chose.

  1. I split my feature class with 5 different values into 5 separate feature classes using the Fox Tools Split By Attribute Tool (http://www.umesc.usgs.gov/management/dss/split_by_attribute_tool.html) .

  2. These feature classes are LG (light green), DG (dark green) , G (grey), R (red), B (blue)

  3. The R feature class is the one I want to identify isolated polygons.

  4. I created dummy variables in the R feature class that I called "G_flag", "LG_flag" etc. These are all integer attributes.

  5. I use "Select by Location"with "Select Features From" the R feature class , and the Source Layer "LG" , and the spatial selection method is "Touch the boundary of the source layer feature".

  6. I then open the attribute table for the R feature class, right click the LG_Flag attribute column, use Field Calculator and make it =1. I then reverse the selection, and use field calculator = 0. This has created a dummy variable that indicates whether each R polygon touches an LG polygon or not (1 = yes, 0 = no).

  7. Repeat step 5 and 6 with Feature Classes DG, B, and G and the appropriate "_flag" attribute.

  8. I then have for every R polygon 4 distinct attributes stating what neighbours it has.

  9. To answer my original question, the R polygons (grasslands lost) that are entirely surrounded by Grasslands Retained (LG) will have LG_flag = 1, and all other flag attributes = 0.

  10. The R polygons (grasslands lost) that are touching forest will have a "DG_flag" value of 1.

NOTE: none of these polygons overlap, this will not work with overlapping polygons. These are all spatially distinct.

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.