Unselecting features using Model Builder

11317
17
Jump to solution
10-04-2013 06:25 AM
StevenGraf1
Occasional Contributor III
I have tried so  many different things to try and unselect some of my data in my model and I can't get it to work.   It anyone can help I would much appreciate it.  I need to unselect the features (places (2)) that are contained in the counties (counties(2)) that were first selected.

Thanks

[ATTACH=CONFIG]28045[/ATTACH]
0 Kudos
17 Replies
AkosKisreti1
Occasional Contributor
I think I got it. I created a new model, you can find it next to your model.
You can run it as a tool and place points inside counties, just load your data into ArcMap before running it.

Akos
0 Kudos
RyanBohan
Occasional Contributor III

Also works in Pro 

RyanBohan_0-1624389532311.png

 

0 Kudos
RichardFairhurst
MVP Honored Contributor
1.  Create two layers based on the same Counties feature class.  I will call them Layer 1 and Layer 2 to keep it straight.

2.  Select your County of interest in Layer 1.  Use the Create New Selection option is Select By Attributes or get a user selection.

3.  On Layer 1 Select By Location on itself (Layer 1) and apply the Intersect option without any buffer or a very small positive buffer (say 1 foot) and select against itself.  This will be the selection of the County itself plus every County that adjoins the original County.  Use the Create New Selection option.

4.  Select by Location against Layer 2 using the Layer 1 feature selection as the location to base the search on and apply the Intersect option without any buffer or a very small positive buffer (say 1 foot).  Use the Create New Selection option.  This will be the selection of every County that is out as far as 2 Counties away from the original County including all Counties within that boundary.

5.  Select by Location against Layer 2 using the Layer 1 feature selection as the location to base the search on and apply a -1 foot (or very small negative) buffer to the selection.  Use the Remove From Selection option.  This will remove all Counties that included the County itself and the first ring of Counties surrounding it (Layer 1 Selection).  Layer 2 now contains every County that is 2 Counties away from the original and only those Counties.

6.  To transfer the selection of Layer 2 back to Layer 1 use Layer 2 as the feature selection you want to select against Layer 1 and apply a -1 (or very small negative) buffer to the Layer 2 feature selection.  Use the Create New Selection option.

No new features had to be created.  This assumes your County layer is topologically correct and that no gaps or overlaps exist along any shared border between any two Counties.

This can be done with real layers in a map or with inmemory layers, so Layer 1 could be a real map layer and Layer 2 could be an inmemory layer if you don't want it to actually appear in your map, and by using step 6 the final result will appear in Layer 1 in your map.

These are the steps you would have to follow to do this manually in Desktop to achieve the effect you want (except that in Desktop there would not be any inmemory layer and you would have to have 2 real layers that were based on the same feature class in your map).
0 Kudos
StevenGraf1
Occasional Contributor III
Thanks for taking the time to look at it!  I understand what you did in the model but it's not working.
0 Kudos
StevenGraf1
Occasional Contributor III
Richard, I got to step 4 and tried to run the model just to see if it would work up to that point and it didn't.  I did have to change the step 2 Select by Attribute to Location to select a point interactively.  I tried both methods of Interact (with and without the buffer) and neither worked.
0 Kudos
RichardFairhurst
MVP Honored Contributor
Richard, I got to step 4 and tried to run the model just to see if it would work up to that point and it didn't.  I did have to change the step 2 Select by Attribute to Location to select a point interactively.  I tried both methods of Interact (with and without the buffer) and neither worked.


Maybe selecting against itself only works in Desktop and not ModelBuilder, so just go from Layer 1 to Layer 2 instead of Layer 1 to Layer 1.  Just keep track of where the selection I described is located and keep transferring selections back and forth until you have a selection in the correct layer at the end.

Here is a model that does a similar thing for the beginning steps.  Notice that I used two separate instances of the same feature class to create the layers (The top two Make Layer tiers).  That may make all the difference.

Anyway, I have a model that does something very similar and it keeps selecting a feature class against itself in two different layers to test that more than 25 property owners other than the original case owners exists within a buffer distance of the case parcels.  I just keep transferring selections back and forth between the two layers based on the same feature class.
0 Kudos
AkosKisreti1
Occasional Contributor
I have tested my model and it worked, so what error did you get?

Did you check if the paths to the data was correct?
0 Kudos
StevenGraf1
Occasional Contributor III
Akos, Thanks for correcting my model.  I'm not sure why it wasn't working the first time but I redownloaded it again and corrected the sources again and it worked.

Thanks to all!
0 Kudos