[Qgis-developer] Support for QGIS variables in Processing

Matthias Kuhn matthias at opengis.ch
Wed Apr 6 06:23:21 PDT 2016


Hi Victor,

On 04/06/2016 02:49 PM, Victor Olaya wrote:
> Hi all
>
> I am trying to add support for QGIS variables in Processing, since
> that can be a useful functionality. To start with, I want to add it to
> scripts, so you can use the @variable syntax in Processing scripts as
> well
>
> It is easy to implement that, but the scope here is not so clear as in
> other places in QGIS where variables are used. It would be nice to
> have the project scope, but also the layer scope of the layers that
> are used are input. I was thinking of using @variable for the project
> scope and layername at variable for the layer scope, but before
> introducing a new notation, I would like to get ideas and feedback
> from you.
>
> Of course, people writing scripts can get variables using the
> QgsExpressionContextScope class...but i want to make it easier and
> have it documented for script developers that do not want to  having
> to dive in the QGIS API docs...
>
> Please, feel free to comment and tell me what you think of this idea,
> and how you think it would be better to implement it. In a second
> step, support might be added to the algorithm dialogs, so inputs such
> as numbers or strings can be entered using variables.

That sounds like an interesting integration.

One question I have is if it's required to see variables as an isolated
topic outside of expressions. Or if whenever a variable is required, a
complete expression would offer much more flexibility.

I also think that it's often implicitly clear from the context an
expression appears in, which layer should be the source of the variables.

What are the use cases you have in mind?

Cheers
Matthias

-- 
Matthias Kuhn
OPENGIS.ch - https://www.opengis.ch
Spatial • (Q)GIS • PostGIS • Open Source


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160406/f20b0ddb/attachment-0001.sig>


More information about the Qgis-developer mailing list