Image a polygon layer with fields calculated from values found in a point layer. No witchcraft, there, as that's what we have all been doing for years.
The polygon layer needs to be populated with counts and aggregates coming from the point layer. This is an operation I will repeat many times during my work.
Here are some of the operations I will want to include. There are more like these.
Sum myNET
aggregate( layer:= 'MyPointLayer_aa66a666_a66a_666a_a6ab_6a6a6aa666', aggregate:= 'sum', expression:= myNET, filter:= contains(geometry(@parent), $geometry))
Sum myNET if myHZyear older than 2010, exclude WP in myHZtype
aggregate( layer:= 'MyPointLayer_aa66a666_a66a_666a_a6ab_6a6a6aa666', aggregate:= 'sum', expression:= myNET, filter:= contains(geometry(@parent), $geometry) AND ("myHZyear" < 2010 OR "myHZyear" is null) AND "myHZtype" != 7206)
Sum myNET if myHZyear older than 2010, exclude WP and FW in myHZtype
aggregate( layer:= 'MyPointLayer_aa66a666_a66a_666a_a6ab_6a6a6aa666', aggregate:= 'sum', expression:= myNET, filter:= contains(geometry(@parent), $geometry) AND ("myHZyear" < 2010 OR "myHZyear" is null) AND "myHZtype" != 7206 and "myHZtype" != 7208)
myNETperArea
myNET / $area / 10000
Instead of doing a lot of clicking each time I have a point layer and a polygon layer and I need to do these calculations betwixt them, I would much prefer to store the calculations in one single operation. I tried in graphical modeler, but that produces one output layer per edited field and also a bunch of new layers. Is it possible to chain field calculator output so that the fields of the input layer are calculated in one go?
I have started to make a model with the graphical modeler with also some steps before what is described here and have also exported that model to a python script. If needed, I can of course dump the whole script here, but wouldn't want to do so right away if the question is clear enough as is.
Some questions I have considered, but nothing much came out of it:
Calculating point layer values within polygon features in QGIS 2
layer:= 'MyPointLayer_...
is hard-coded in the formula and I have to go into each of the steps and edit the string every time I have a new project with that chain of algorithms, but I guess it's still better than doing it manually each time.