1

I am trying to build a complicated model in the model designer. It will have, once I'm done, probablyy around 20-30 conditional branches. The branches select and extract points from a point layer with a given value and then draw lines, closed or open, depending upon the value. Unfortunately as I have it set up the model first runs the initial algorithm from each branch, meaning that when it gets to drawing onto the canvas it is only using those points that it selected most recently.

So, if you look at my model below it first select 'PX', then 'P1', then 'QX', then 'Q1' and when it moves onto drawing onto the canvas it is only using the 'Q1' selection.

My question is, does anyone know a way that I can specify "Run this brance first, then move onto the next"?

Edit: Here is the model in question.

enter image description here

14
  • Try to create a reduced model that helps to understand only the actual problem, not your whole workflow. Best would be to share this dummy model for testing. Otherwise, one first has to try to recreate a model, based on many assumptions, what takes a lot of time, is cumbersome and still maybe would not reflect your very problem.
    – Babel
    Commented Dec 3, 2023 at 11:24
  • Thanks for replying, and thanks again for the help yesterday. Commented Dec 3, 2023 at 11:28
  • The project is drawing archaeological features that have been measured in with a total station. P refers to a closed line to be drawn and Q to an open line, with 1-10 showing the level being recorded and X meaning that the level is undefined. As not every excavation has 10 levels (thank god!) I need the model to ignore a branch where there is no, for example, P2-P10. I will try to figure out how to share the model.# Commented Dec 3, 2023 at 11:31
  • Also, 'Select 'art'' is the conditional branch using the expression aggregate(layer:='inlayer', aggregate:='count', expression:="art", filter:="art" IN('QX'))>0 Commented Dec 3, 2023 at 11:33
  • 1
    That's the problem. The model runs through the first stage of each branch and then runs the second stage. This means that it only runs the later stages of the branches on the last points selected. The model should output two circles and a line. But as the points in the line were the last ones selected it only draws the line. I need to find a way that it runs "branch PX" from beginning to end, then runs "branch QX" from beginning to end, and so on until all branches have been run, or skipped due to not meeting the conditions. Commented Dec 3, 2023 at 12:52

1 Answer 1

0

I created a simplified model: download here. It connects points with attribute value PX in field art by a closed line, those with value QX by an open line.

Instead of conditional branch and then somehow try to run one of the branches before the other one, you can simply duplicate your input and than run both processes in parallel. To duplicate, run the Rename algorithm twice to create two layers with different names. Then use these as input for each part.

If you need to re-run the same procedure over and over again for different levels, I would advice not to include that in the model (as it would get rather complex), but rather run the model in Batch Mode - or create another model which calls the first model. This would keep things simpler.

enter image description here

This is the output I get using your layer with my model. Be aware: closing paths can lead to invalid geometries (self crossing lines) as is the case with the line in the bottom center: enter image description here

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.