[GIS] How to SWITCH_SELECTION after Select Layer By Location in ModelBuilder

arcgis-desktopmodelbuilderselect-by-location

I have to use Geoprocessing tools in ModelBuilder.

My requirement is compare features in a Source personal geodatabase with those in a Target personal geodatabase and if the target personal geodatabase has extra captured features then to export them as a shapefile.

I am using Select Layer By Location tol first select all intersecting features in source and target personal geodatabases and then trying to switch selection in that same Select Layer By Location tool.

How can I SWITCH_SELECTION in the select in location Select Layer By Location tool?

enter image description here

Best Answer

You should use each select operation one at a time.

  • The first one, that is in your model should be defined as NEW_SELECTION only;
  • Then use another Select Layer by Location (or by Attributes, it shouldn't matter) on the output of the first Selection, and choose SWITCH_SELECTION without defining any expression.

This should do the job.

EDIT: Further comments

The reason you do not see any selection in the output of your model is that you use MAKE FEATURE LAYER tool which creates a temporary layer within your model; thus in order to see the output you should export it to a new layer. You can use the copy features tool to export selected features. See result below (non intersecting polygons are populating a new layer and symbolized as hollow polygons with red border)

Results with export

This is the model I used:

Model to export selected

If you wish to only select features in your already existing feature class, you can drop the Make Feature Layer tool and preform selection directly on your layers. See results and model below (note that in order to see the selection on the view window you should zoom-in or out to perform rendering):

Selection no Export

and the model:

Model no export