Select to view content in your preferred language

Calculate Field on Records Selected by Location in Modelbuilder not Calculating

2343
3
Jump to solution
04-27-2012 02:23 PM
MikeMacRae
Frequent Contributor
I have created a model and I have added a 'Select by Location' query to select records from a polygon feature class that lies outside of another polygon feature class.

[ATTACH=CONFIG]13900[/ATTACH]

So, I set the selection to choose all feature from the first polygon feature class 'WITHIN' the second polygon feature class and then set the 'Selection Type' to 'SWITCH_SELECTION' to get the feature outside.

[ATTACH=CONFIG]13899[/ATTACH]

I then use the 'Calculate Field' using the output of the select by location above, as an input to calculate a field called 'Comment' with the string 'Area2 outside of Area1' in hopes that it will only calculate the selected features.

[ATTACH=CONFIG]13901[/ATTACH]

It is not doing this. It's calculating all the records. How to I only calculate the selected records?

Thanks,
Mike
0 Kudos
1 Solution

Accepted Solutions
MikeMacRae
Frequent Contributor
Hey, thanks for the help! I discovered that you have to use the 'Select Layer by Location tool' to select the records and then use the 'Select by Attributes' immediately after that and choose 'Switch Selection'

View solution in original post

0 Kudos
3 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor
I think you need to use Select Layer By Location tool twice to get the opposite/switched selection:
First, use the tool to make a NEW_SELECTION by an expression.
Second, use the tool to SWITCH_SELECTION, without any expression.
0 Kudos
by Anonymous User
Not applicable
Original User: PhillipR

If you have a whole bunch of points that reside in and outside of for example a polygon feature class. This is how I would go about it.

Try selecting all (points) and then using the Select by Layer By Location remove all (points) that are completely within the selecting features.(polygons) etc..

[ATTACH=CONFIG]13918[/ATTACH]
0 Kudos
MikeMacRae
Frequent Contributor
Hey, thanks for the help! I discovered that you have to use the 'Select Layer by Location tool' to select the records and then use the 'Select by Attributes' immediately after that and choose 'Switch Selection'
0 Kudos