4

I'm looking to create five fields of grouped means within 33 shapefiles. I'm using the Graphical Modeler to save me using the Field Calculator 5 x 33 times.

The new fields are the means of the traffic volumes ("AADT") of five modes, grouped by road types ("DESC_TERM") in the shapefiles. These functions work when calculating 'manually':

mean( "AADTallc_1" , "DESC_TERM" , "AADTallc_1" != 0.0)
mean( "AADTalllgv" , "DESC_TERM" , "AADTalllgv" != 0.0)
mean( "AADTTaxi" , "DESC_TERM" , "AADTTaxi" != 0.0)
mean( "AADTMotorc" , "DESC_TERM" , "AADTMotorc" != 0.0)
mean( "AADTLtBus" , "DESC_TERM" , "AADTLtBus" != 0.0)

I've created this flow on Graphical Modeler:

Model flow

Where for LGVs (where the model fails);

LGVs input

With the failure message "An error occurred while evaluating the calculation string: Cannot use aggregate function in this context":

Failure message

What could be going wrong?

I tried changing the parameters, but nothing seems to work.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jan 20, 2018 at 17:10
5
  • Did you find any documentation that says that this should work? I'm not sure it's possible to calculate aggregates like this. Commented Jan 20, 2018 at 19:57
  • Not in particular, I was following this video for the basic structure: youtube.com/watch?v=XyPW8mzssZE It works for the first procedure (road_car) but not the second Commented Jan 21, 2018 at 14:10
  • What does road_car do? Please include a screenshot Commented Jan 21, 2018 at 16:34
  • road_car produces the same output as the LGVs step but for cars, using mean( "AADTallc_1" , "DESC_TERM" , "AADTallc_1" != 0.0) under Formula. Commented Jan 22, 2018 at 16:42
  • Same problem for me with 2.18.16. When i use refactor fields with 'aggregate' function from processing toolbox , it works. But not in model... Formula is concatenate( "vote" , "id_ws" , "user" NOT LIKE 'zp%' AND "user" NOT LIKE 'zp%') Commented Jan 26, 2018 at 14:41

1 Answer 1

4

The issue looks solved.

You should update since 2.18.17 is released or try to install nightly from osgeo4w with the advanced install.

https://issues.qgis.org/issues/17300

answered Jan 26, 2018 at 14:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.