I use the QGIS Graphical Modeler to run a few tools (Fix Geometries and Vector Intersection so far). I use this as a batch process to extract information coming from several different shp-sources spanning the entirety of Sweden, and load all information pertaining to a selected area (user-drawn polygon) back into the model.

Now I would like this Model to only load layers that have geometries. How would I go about culling the empty layers within the Graphic Modeler before loading?

I use QGIS 3.22.12.

2 Answers 2


Add an algorith Filter by Geometry Type. Create outputs for point, line and polygon type only and use this as input for further processing.

enter image description here

  • Empty layers are still loaded into the model. Maybe this is because I use the batch process?
    – kaj.n
    Nov 29, 2022 at 14:45
  • Yes, this tools works only for layers loaded already. Can you filter the non geometry layers based on any criteria like file name, folder or filetype?
    – Babel
    Nov 29, 2022 at 14:53
  • Unfortunately no, they all have geometry going in to the Graphical Modeler (perhaps I was unclear in my last comment), but when intersected only a few of them will retain their geometries. The batch process will however want to create layers for all of them.
    – kaj.n
    Nov 29, 2022 at 15:14
  • So why do you want to avoid loading "no geometry-layers"? Beacause it would take too long/too large file size? Or is it simply that you want to run the model only for layers with geometry? If it is this last case, you can use the solution above: load all layers, filter by geometry type, run rest of algorithms for the filtered layers only.
    – Babel
    Nov 29, 2022 at 15:21
  • I think I'm not being clear what I mean. It's not that I don't want to load empty layers INTO the graphical modeler, it's that I don't want to load empty layers FROM the graphical modeler to the qgis model.
    – kaj.n
    Nov 30, 2022 at 10:17

The QGIS Modeler seems not to be able to treat files (layers) that are not loaded. But you can load the files and then check their geometry type with the algorithm Conditional Branch. Then run the geometry part of your model only for those of the loaded layers that have a geometry.

In the Conditional branche, create a condition GEOM with the expression layer_property (@input, 'geometry_type') <> 'No geometry' - so GEOM gets the value of 0/false for non geometry types and 1/true for geometry layers. Then use this condition GEOM to run the buffer: at the bottom of the Buffer dialog box, select Dependencies (click ...) and check the box next to Condition "Geom":

In the example below, layers are loaded and then for layers containing a geometry, a buffer is created, based on the conditional branch:

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.