SQL Select Attributes from a Table > Intersect with feature > remove intersecting features with Modelbuilder

1069
4
Jump to solution
09-16-2021 10:51 AM
MPach
by
Occasional Contributor II

The goal with my model is to locate features that intersect a feature class of sewer mains. After a sewer main is determined to intersect with a feature I need to remove the ability to select that feature from the list then continue. Right now I'm using a Switch Selection to select all the features that are left minus the previously selected mains, but unfortunately this idea doesn't work because if there were zero features selected during the intersect process the switch selection will result in returning the entire original table which would ruin the process of eliminating mains as I proceed down the list of features I need to intersect with. 

I'm going to try to break this down in a linear format to make it easier to understand. 

Select sewer mains that Intersect with a Buildings feature class > Assuming there are results create a feature layer from the selection > Perform a Switch Selection on the sewer mains table to find the remaining sewer mains > Use the Select by location to find the intersection of the remaining sewer mains against railroad tracks > Create a feature layer for those > Repeat until through the list.

I'm certain there are better ways to do this using Modelbuilder, but I'm mentally blocked from seeing them right now. I need some help please. 

Also, I'd like to use Modelbuilder for this and not Python right now. 

I'm pretty sure I'm making this more complicated than I need to so, I thank you all in advance. 

Mark

0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

@MPach ,

This modelbuilder does what you are after if I understood your workflow correctly:

Make sure the first Select Layer By Location has Invert spatial relationship ticked on.

MehdiPira1_4-1631844317958.png

 

MehdiPira1_1-1631843886813.png

 

 

View solution in original post

0 Kudos
4 Replies
MehdiPira1
Esri Contributor

@MPach ,

This modelbuilder does what you are after if I understood your workflow correctly:

Make sure the first Select Layer By Location has Invert spatial relationship ticked on.

MehdiPira1_4-1631844317958.png

 

MehdiPira1_1-1631843886813.png

 

 

0 Kudos
MPach
by
Occasional Contributor II

Hummm,  that's an interesting idea. I don't know if even saw that being an option. I have to test it first and see what happens. Thank you. Also, regardless of that solution you led me to find the Get Count tool, which I had forgotten about, and I bet I can make that work too. 

Thanks, 

Mark

0 Kudos
MehdiPira1
Esri Contributor

@MPach 

I believe the solution answered your question.

0 Kudos
MPach
by
Occasional Contributor II

@MehdiPira1 I'm not actually sure that solution works, but I haven't tested it yet. I think the suggested solution that you recommended might have the same flaw as the one that I first tried. That flaw being if there is no intersection of the features the table selection that will be returned would be the entire contents of the original table. 

I sketched up a quick drawing of the flow to get to the solution. I hope it's legible. 

I think the solution involves using a test case (If...Then....Else workflow) to see if the row count of the intersection is = 0 and then if that occurs I use the previous tables selection in the next part of my workflow. Doing that I should still be proceeding in the right direction instead of starting over with the original data table. 

 

MPach_0-1632164965050.png

 

0 Kudos