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

Stu Smith
  • 8,252
  • 8
  • 35
  • 84
  • @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 01 '23 at 10:38
  • 2
    Add Drop geometries algorithm to the solution by @Matt : https://docs.qgis.org/latest/en/docs/user_manual/processing_algs/qgis/vectorgeneral.html#drop-geometries – Babel Apr 02 '23 at 20:26

1 Answers1

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

Matt
  • 16,843
  • 3
  • 21
  • 52