Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-25 Thread Anita Graser
Hi, I've started a PR with the aggregate expression example here: https://github.com/qgis/QGIS-Documentation/pull/3769 Regards, Anita On Tue, May 21, 2019 at 12:15 AM Nyall Dawson wrote: > On Tue, 21 May 2019 at 05:53, Anita Graser wrote: > > > > Dear Nyall, > > > > for f in

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-20 Thread Nyall Dawson
On Tue, 21 May 2019 at 05:53, Anita Graser wrote: > > Dear Nyall, > > for f in vl.getFeatures(): > scope[-1].setFeature(f) This works, but isn't very nice. Better to use context.setFeature(f) (behind the scenes it's doing the same, but is more descriptive and has some extra checks,

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-20 Thread Anita Graser
Dear Nyall, On Mon, May 20, 2019 at 9:01 AM Anita Graser wrote: > Thank you Nyall, that's really helpful! The expression system is awesome > and powerful but I don't think anyone could guess how to use it correctly > in PyQGIS. > I'll write it up into a tutorial and the documentation team is

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-20 Thread matteo
> I agree. I'm only hesitant since I don't have a doc writing setup on my > Windows machine yet and the instructions seem to be Linux only. actually there are linux only instructions only if you want to run test locally. Once you make a pull request, travis runs also for code snippets > I'll

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-20 Thread Anita Graser
On Mon, May 20, 2019 at 9:41 AM matteo wrote: > Hi Anita, > > you hit a good missing topic in the pyqgis documentation. I see very > often people asking for support on Expressions and their use in pyqgis. > > What do you think to add the example also in the pyqgis documentation > directly? Since

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-20 Thread Anita Graser
On Mon, May 20, 2019 at 2:37 AM Nyall Dawson wrote: > On Mon, 20 May 2019 at 01:21, Anita Graser wrote: > > I'd like to add an example of an aggregate expression to my recent > PyQGIS 101 tutorial on expressions [0]. I got expressions for individual > features working but cannot figure out how

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-19 Thread Mathieu Pellerin
This is such an instructive reply it should be added to stackexchange straight away! :) On Mon, May 20, 2019, 07:37 Nyall Dawson wrote: > On Mon, 20 May 2019 at 01:21, Anita Graser wrote: > > > > Hi, > > > > I'd like to add an example of an aggregate expression to my recent > PyQGIS 101

Re: [QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-19 Thread Nyall Dawson
On Mon, 20 May 2019 at 01:21, Anita Graser wrote: > > Hi, > > I'd like to add an example of an aggregate expression to my recent PyQGIS 101 > tutorial on expressions [0]. I got expressions for individual features > working but cannot figure out how to set the context for aggregate >

[QGIS-Developer] Expressions with aggregate in PyQGIS

2019-05-19 Thread Anita Graser
Hi, I'd like to add an example of an aggregate expression to my recent PyQGIS 101 tutorial on expressions [0]. I got expressions for individual features working but cannot figure out how to set the context for aggregate expressions correctly. As far as I can tell, the PyQGIS Cookbook doesn't