[GIS] Iterating Select By Location in ModelBuilder

arcgis-desktopmodelbuilderselect-by-location

I need to do exactly what the help topic http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#/Select_By_Location_Select_based_on_spatial_relationship_within_the_layer/0017000000tr000000/ says can be done, but they do not include the model architecture:

The Select Layer By Location tool allows the Input Feature Layer to be
the same the layer specified in theSelecting Features parameter. A
useful application of this behavior is to select adjacent, connected,
or nearby features within a layer. Different Relationship options can
be used to generate the desired analysis or result. For details of how
the Relationship options differ, see Select By Location: graphical
examples.

A loop inside a script or the For or While iterators in ModelBuilder
can be used in conjunction with this approach to expand a selection
based on a number of iterations or until some criterion is met. One
common criterion is expand until no new features are added to the
selection.
The Get Count tool can be used to establish when the
number of selected features stops changing (therefore stops growing).

Could someone show me how this type of model is put together?

I'm especially having trouble determining where I can put GetCount functions in the model to get numbers of selected features before and after each Select by Location, and also figuring out where to put a While iterator (if indeed that is the correct iterator to use) so that only the Select by Location process is repeated and not the entire model.

Best Answer

Figured it out finally. Have to make a submodel that does the initial selection, then a submodel that does the select by location, set up your input and output parameters for each submodel correctly, and then hook them together.

Full model Sub-models