2

I have created a simple model on ArcGIS Pro 3.0 that selects by location and produces a clean output shapefile.

I have added the logical operator "If Selection Exists" (Layer name: Layer with selection, selection condition: Exists) to only run "copy features" and "delete fields" when any feature is selected (True) or to run a simple python script "Empty Output" that pops up a message when no features are selected (False). - I set preconditions for both True and False.

For some reasons when I tested the model in an area where there weren't any features that could be selected, the model still copied the feature (creating an empty shapefile) as if the conditions were true (and in fact it doesn't even run the Python script).

What I am doing wrong? the model

1 Answer 1

3

As you have shown your model, I too would have expected the model to run your Empty Output script tool if the If Selection Exists tool returned False.

I think the naming of the tool and its default settings are unclear in what its actually doing and if you explore the help file it says

This tool does not make a selection or evaluate an SQL expression or where clause. It simply checks if a selection set matches a specified value.

I believe the key words in that statement are "selection set". Your select by location tool when it runs and does not select any features is creating a selection set of nothing, which us mere mortals would interpret as no selection...seems logical, but a selection set exists... with nothing in it. So the tool returns True as a selection of nothing exists... Clear as mud? ;)

Change the condition to this and the logic should run as you expect:

If Selection exists

1
  • hey Hornbydd thank you so much for that! it makes sense, you've relieved me of a big headache!
    – chlha
    Commented Oct 6, 2022 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.