2

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:

layer_property('actualLayerNameAsItShowsInTheLayesPanel','name')

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')

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')

Cheers

  • 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... – Andy Harfoot Mar 15 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.