Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using the Select by Location tool to select certain polygons on my shape-file layer. I start by having a given point as my Selecting Feature and that its relationship is completely_ contains. After I run the tool the first time, I get the polygon feature that my point is in (lets call it Polygon A). When I run another select by feature tool that its relationship is boundary_touches my Polygon A, I get a layer that also contains Polygon A and the features that share boundaries with it. Is there a way I can prevent this from happening? Meaning that every time I run the select by location tool it doesn't select polygons from the previous time. Or is there a tool or a way that will allow me to join multiple layers together and remove duplicate features? I have tried the Union tool as well as the Intersect tool. Any suggestions?


share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Here's a workflow, where MyPolygons is your polygon layer, MyPoints is your points layer, and MyNeighbors is your layer of features that neighbor MyPolygons.

  1. Set your selection method to "Create a new selection".
  2. Select from MyPolygons that completely contain MyPoints. This will result in what you called "Polygon A".
  3. Select from MyNeighbors that boundary touch MyPolygons. You can use the "Use selected features" flag to limit MyPolygons to those that were selected in Step 2.
  4. Change your selection method to "Remove from selection."
  5. Repeat Step 2. This will remove your Polygon A from the current selection.

EDIT: Instructions for finding second-order neighbors ONLY begins here.

Step 1: Select your starting polygon.

Starting polygon

Step 2: Run select by location with the below parameters.

Neighbor parameters

Step 3: Your results will look like this. Export this out as a separate shapefile.

1st order neighbors + starting polygon

Step 4: Run your select by location with the same parameters as step 2. Your result will look like this.

2nd order neighbors + 1st order neighbors + starting polygon

Step 5: Run select by location with new parameters and the shapefile you exported in Step 3.

Parameters to remove 1st order neighbors

Step 6: This will remove your first order neighbors (shown below in pink) from the current selection. You will now have ONLY second order neighbors.

2nd order neighbors only

share|improve this answer
Hey, When I did what you said I got the same result as the first select by location. I made a pdf of the steps I followed just to show you. imgur.com/A10eN –  user8759 Jul 31 '12 at 16:52
This may be a little easier to see imgur.com/QRepB&0w9Dl –  user8759 Jul 31 '12 at 16:57
@user9235 I assume your lower screenshot is Step 5 above. If so, you did not follow it correctly. It should be exactly the same as Step 2 with only the Selection Type parameter being different. So Input should be MyPolygon, Relationship should be Completely contains, and Selecting Features should be MyPointEvents. All you are doing is unselecting your starting polygon. –  dmahr Jul 31 '12 at 17:31
Okay let's start from scratch. 1) Select watersheds that completely contain your points layer; this should be a "new selection". 2) Select watersheds that neighbor your currently selected watersheds; this should also be a "new selection". 3) Select watersheds that completely contian your paints layer; this should be a "remove from selection" operation. –  dmahr Jul 31 '12 at 18:19
You could use ModelBuilder to automate the process. Use the "Copy Features" geoprocessing tool to export the features each time. The other option which would take longer to setup but would run much faster is to use Python to generate a table of polygon to polygon neighbors. This is similar to what I did here except that you will have to iterate outwards to find 2nd, 3rd, or 4th order neighbors. –  dmahr Aug 1 '12 at 17:49
show 7 more comments

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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