+ Reply to Thread
Results 1 to 4 of 4

Thread: Calculate Field on Records Selected by Location in Modelbuilder not Calculating

  1. #1
    Mike MacRae
    Join Date
    Nov 2010
    Posts
    310
    Points
    32
    Answers Provided
    4


    0

    Default Calculate Field on Records Selected by Location in Modelbuilder not Calculating

    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.

    Click image for larger version

Name:	slectbylocation2.jpg
Views:	140
Size:	101.1 KB
ID:	13900

    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.

    Click image for larger version

Name:	slectbylocation.jpg
Views:	82
Size:	97.4 KB
ID:	13899

    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.

    Click image for larger version

Name:	slectbylocation3.jpg
Views:	61
Size:	75.5 KB
ID:	13901

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

    Thanks,
    Mike

  2. #2
    Dan Lee

    Join Date
    Oct 2009
    Posts
    582
    Points
    143
    Answers Provided
    27


    1

    Default Re: Calculate Field on Records Selected by Location in Modelbuilder not Calculating

    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.
    Last edited by 1812; 04-30-2012 at 08:48 AM. Reason: corrected a typo
    Dan (Geoprocessing)

  3. #3
    Phillip Rofe
    Join Date
    Apr 2012
    Posts
    2
    Points
    1
    Answers Provided
    0


    1

    Default Re: Calculate Field on Records Selected by Location in Modelbuilder not Calculating

    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..

    Click image for larger version

Name:	SelectbyLocation.jpg
Views:	58
Size:	92.4 KB
ID:	13918

  4. #4
    Mike MacRae
    Join Date
    Nov 2010
    Posts
    310
    Points
    32
    Answers Provided
    4


    0
    This post is marked as the answer

    Default Re: Calculate Field on Records Selected by Location in Modelbuilder not Calculating

    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'

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts