So I start my model by dragging an input layer, which in my case it happens to be a vector layer. Let's call it inputVectorLayer. Later on in the model I want to refactor this layer using the Refactor fields algorithm. For each feature I write the correct expression, but for one feature I need an expression that should include something like this:

layer_property('inputVectorLayer', 'name')

The problem is that it doesn't recognize the name that I gave to the representation of the input layer in the Model Builder. How can I achieve this?

If I do something like this:


it works, but obviously, this name changes. That's the whole point of the module, to use aliases to reference input layers. I already tried to use double quotes to no avail layer_property("inputVectorLayer", 'name')

  • Did you find any solution to this ? Commented Dec 20, 2022 at 23:51
  • @CésarArquero Sorry. I even forgot what I was up to at the time. I don't think I found any solution and I can't even check, as I just don't know when and what I used the QGIS modeler for. This shows that I managed to create a good general question out of my particular use case, but it also means that I'm looking at this question as if it's the first time I'm seeing it.
    – Andrei
    Commented Dec 22, 2022 at 13:03
  • 1
    Thanks for replying. I found that changing the input to "vectorial objects" the layer_property function actually works. Here is a solution for something similar: gis.stackexchange.com/questions/446636/… Commented Dec 22, 2022 at 15:43

2 Answers 2


It might be too late but I just faced the problem today... You can do it with the layer_id:

 layer_property(@layer_id, 'name')
  • Note that @layer_id only references the input layer when it is used in the first tool connected to that input. So the name will need to be stored (as an attribute) if it is required later in the model. There are variables of the parameters exposed, but a 'Vector layer' input variable is not of <layer> or <layerid> type seemingly... Commented Mar 15, 2019 at 14:27

Here is a possible solution: Using input parameter as part of SQL query in QGIS model

Currently, the layer_property function doesn't work with and input like "vectorial layer", but it works with the "vectorial objects" input. As all the other inputs work equally with this input, attributes from layer for example, if you just change the input you can get the layer properties with that function.

I hope it helps.

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.