5

At 3.28.4, I am trying to automate a series of manual steps using the Model Designer.

One of the manual steps that I would like to automate uses the Layer > Create Layer > Create Virtual Layer tool. However, this tool does not seem available to the model environment, nor can I find an equivalent in the Processing Toolbox.

There's a similar SEGIS post from 2017, but the answer required code, and I am not a programmer.

How can I create a Virtual Layer in my model?

Edit:

Matt's proposed answer - to use the Execute SQL tool - works with one exception: it always outputs a point layer (with EPSG 4326), even though:

  1. My input is a non-spatial Geopackage table
  2. I use either the Not Selected, Autodetect, or No Geometry Geometry types (screenshot below).

I need a non-spatial Geopackage table output.

(Maybe this should be a separate SE post regarding the Execute SQL tool???)

enter image description here

2
  • @Stu_Smith if create virtual layer is not available in the algorithms list of the modeler, I'm afraid that it is not (yet) possible to use virtual layers in models, but I might be wrong.
    – Babel
    Apr 1, 2023 at 10:38
  • 2
    Add Drop geometries algorithm to the solution by @Matt : docs.qgis.org/latest/en/docs/user_manual/processing_algs/qgis/…
    – Babel
    Apr 2, 2023 at 20:26

1 Answer 1

9

You can use the tool Execute SQL. It is not a Virtual Layer per se, but hopefully it allows you to do what you need.

enter image description here

enter image description here

enter image description here

1
  • Close! Execute SQL generates output, but please see my edit in the OP.
    – Stu Smith
    Apr 2, 2023 at 20:22

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.