4

In QGIS 3.22.11 I have a model with around 15 output, and a majority of them are empty most of the time. Is there a way to prevent layers with no entities to show up in QGIS after the model?

I tried with conditional branches, but i can't find anything to count entities in an output of an algorithm in the modeler.

I see how I could do this with Python, but I'd rather keep it as a graphical model.

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Nov 8, 2022 at 13:02
4
  • 1
    Empty output, like null geometries or like a feature with no records in the attribute table ? Commented Nov 8, 2022 at 13:47
  • No record at all. It's an extract by expression, where the condition is never met. Commented Nov 8, 2022 at 14:17
  • Does it work in a normal mode ? Commented Nov 8, 2022 at 14:19
  • It is the way it is supposed to work. That is a check on the data. If the condition is met ( = the data is not valid), the data comes up in the table, shows up on Qgis and can be handled by the user. If all data is valid, the table is empty, and no further investigation is needed. But the model still makes an output, the empty table, that I have to delete evrytime. I want only the non empty table to show up. Commented Nov 8, 2022 at 14:55

2 Answers 2

1

Yes, there is a solution for this. You need to use Modeler tools > Conditional branch.

In the condition write this statement:

layer_property(@[SPECIFIC_LAYER], 'feature_count')>0

and then you have to mark the dependency on the FOLLOWING PROCESS, so if after the process the feature count will be zero modeler will not PROCESS THE FOLLOWING algorithm and of course there will be no output. But you need to create separate condition for each tool, otherwise it wont work. Good luck!

enter image description here enter image description here

answered Mar 5 at 14:13
0

My easier solution was "Split Layer by". And the output will write just layers who has at least one feature. TIP: FME Safe Software could help you a lot!

answered Jul 26, 2023 at 0:34
1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. Commented Jul 26, 2023 at 7:39

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.