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.
-
1Empty output, like null geometries or like a feature with no records in the attribute table ?Taras– Taras ♦2022年11月08日 13:47:57 +00:00Commented Nov 8, 2022 at 13:47
-
No record at all. It's an extract by expression, where the condition is never met.f.hin– f.hin2022年11月08日 14:17:27 +00:00Commented Nov 8, 2022 at 14:17
-
Does it work in a normal mode ?Taras– Taras ♦2022年11月08日 14:19:24 +00:00Commented 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.f.hin– f.hin2022年11月08日 14:55:12 +00:00Commented Nov 8, 2022 at 14:55
2 Answers 2
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!
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!
-
1Your 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.2023年07月26日 07:39:34 +00:00Commented Jul 26, 2023 at 7:39
Explore related questions
See similar questions with these tags.