Re: [Qgis-user] QGIS custom python function with zero or more args

2018-03-09 Thread Fuenfer-Koenigstein.Benjamin2
Von: Qgis-user <qgis-user-boun...@lists.osgeo.org> Im Auftrag von fuenfer-koenigstein.benjam...@swm.de Gesendet: Freitag, 9. März 2018 09:19 An: Qgis-user@lists.osgeo.org Betreff: [Qgis-user] QGIS custom python function with zero or more args Hi all, I would like to write a custom python function f

Re: [Qgis-user] QGIS custom python function with zero or more args

2018-03-09 Thread Frank Broniewski
09:19 An: Qgis-user@lists.osgeo.org Betreff: [Qgis-user] QGIS custom python function with zero or more args Hi all, I would like to write a custom python function for QGIS 2.18 that takes zero or one argument. The reason is that in most cases I can use a default value in the function, in some c

Re: [Qgis-user] QGIS custom python function with zero or more args

2018-03-09 Thread Stefan Giese (WhereGroup)
Hi Benjamin, you can do it like this example which only makes a sum of 2 values. Two aruments or only one...: -- @qgsfunction(-1, 'Python') def add_values( values, feature, parent): if len(values) == 2: return values[0]+values[1] elif

[Qgis-user] QGIS custom python function with zero or more args

2018-03-09 Thread Fuenfer-Koenigstein.Benjamin2
Hi all, I would like to write a custom python function for QGIS 2.18 that takes zero or one argument. The reason is that in most cases I can use a default value in the function, in some cases I would like to enter the value as argument. For python I know that you can prefix args in functions