Skip to main content
my original answer didn't solve the problem, so I suggested several more methods to try.
Source Link
csk
  • 25.1k
  • 3
  • 33
  • 72

Intermediate output layers are usually called somethingI find the processing modeller extremely challenging to work with, and not as well documented as I'd like it to be. Since my first suggestion didn't work, I have a couple of other suggestions.

This was my first suggestion, which didn't work:

Intermediate output layers are usually called something like 'Toolname of layername'. Eg, the output of running the clip tool on a layer called 'vectorlayer', is probably called something like 'Clip of vectorlayer'. You can find the exact name of an intermediate output by adding any algorithm that would let you choose the intermediate output as input from a dropdown menu. Make a note of what the intermediate outputs are called, and use that name in your difference() expression.

Suggestion number two:

I wonder if the issue could be as simple as that the it's expecting a string for 'LayerB', but the string 'Toolname'Difference' offrom layername'algorithm 'Building_frontbuffer' because has single quotes inside it. EgSo if you used ''Difference' from algorithm 'Building_frontbuffer'' for 'LayerB', I believe it would be interpreted as three separate strings, with gibberish in between.

  • first string: ''
  • gibberish: Difference
  • second string: `' from algorithm '
  • gibberish: Building_frontbuffer
  • third string: ''

If this is the output of runningissue, you need to escape the single quote characters, so the expression can understand the entire layer name (clip'Difference' from algorithm 'Building_frontbuffer' tool on) as a layer called 'vectorlayer'single string.

According to this Q&A, is probably called something like Is there an escape option for single quotes & apostrophes in QGIS?, you can just put single quotes around a string with single quotes in it. I wouldn't have thought that would work, but it's worth trying:

'Clip''Difference' offrom vectorlayer'algorithm 'Building_frontbuffer''. You can find

Note that the exact name of an intermediate output by adding any algorithmstring starts and ends with two single quote characters, not one double quote character. ('' is ' twice, not ")

If that would let you choosedoesn't work, try escaping the intermediate output as inputsingle quote with \, like this:

'\'Difference\' from algorithm \'Building_frontbuffer\''

(Based on suggestions from this Q&A on stackoverflow: Replacing an apostrophe in a string.)

Suggestion number three:

As a dropdown menuworkaround, make the 'difference' output a permanent layer. MakeDefine the layer name and filepath with a note ofstring input. This way you know exactly what the intermediate outputs arelayer is called, andso you can use thatthe correct layer name in your difference()the expression.

Final suggestion:

If none of the above suggestions works, and you can't find a solution, you just have to end the model at this point. Make the final output of your model a permanent layer from 'Difference' from algorithm 'Building_frontbuffer'. Put the rest of your steps from the original model into a new model.

Intermediate output layers are usually called something like 'Toolname of layername'. Eg, the output of running the clip tool on a layer called 'vectorlayer', is probably called something like 'Clip of vectorlayer'. You can find the exact name of an intermediate output by adding any algorithm that would let you choose the intermediate output as input from a dropdown menu. Make a note of what the intermediate outputs are called, and use that name in your difference() expression.

I find the processing modeller extremely challenging to work with, and not as well documented as I'd like it to be. Since my first suggestion didn't work, I have a couple of other suggestions.

This was my first suggestion, which didn't work:

Intermediate output layers are usually called something like 'Toolname of layername'. Eg, the output of running the clip tool on a layer called 'vectorlayer', is probably called something like 'Clip of vectorlayer'. You can find the exact name of an intermediate output by adding any algorithm that would let you choose the intermediate output as input from a dropdown menu. Make a note of what the intermediate outputs are called, and use that name in your difference() expression.

Suggestion number two:

I wonder if the issue could be as simple as that the it's expecting a string for 'LayerB', but the string 'Difference' from algorithm 'Building_frontbuffer' because has single quotes inside it. So if you used ''Difference' from algorithm 'Building_frontbuffer'' for 'LayerB', I believe it would be interpreted as three separate strings, with gibberish in between.

  • first string: ''
  • gibberish: Difference
  • second string: `' from algorithm '
  • gibberish: Building_frontbuffer
  • third string: ''

If this is the issue, you need to escape the single quote characters, so the expression can understand the entire layer name ('Difference' from algorithm 'Building_frontbuffer') as a single string.

According to this Q&A, Is there an escape option for single quotes & apostrophes in QGIS?, you can just put single quotes around a string with single quotes in it. I wouldn't have thought that would work, but it's worth trying:

''Difference' from algorithm 'Building_frontbuffer''

Note that the string starts and ends with two single quote characters, not one double quote character. ('' is ' twice, not ")

If that doesn't work, try escaping the single quote with \, like this:

'\'Difference\' from algorithm \'Building_frontbuffer\''

(Based on suggestions from this Q&A on stackoverflow: Replacing an apostrophe in a string.)

Suggestion number three:

As a workaround, make the 'difference' output a permanent layer. Define the layer name and filepath with a string input. This way you know exactly what the layer is called, so you can use the correct layer name in the expression.

Final suggestion:

If none of the above suggestions works, and you can't find a solution, you just have to end the model at this point. Make the final output of your model a permanent layer from 'Difference' from algorithm 'Building_frontbuffer'. Put the rest of your steps from the original model into a new model.

Source Link
csk
  • 25.1k
  • 3
  • 33
  • 72

Intermediate output layers are usually called something like 'Toolname of layername'. Eg, the output of running the clip tool on a layer called 'vectorlayer', is probably called something like 'Clip of vectorlayer'. You can find the exact name of an intermediate output by adding any algorithm that would let you choose the intermediate output as input from a dropdown menu. Make a note of what the intermediate outputs are called, and use that name in your difference() expression.