Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate functions in Field Calculator in modeller #25198

Closed
qgib opened this issue Oct 17, 2017 · 13 comments
Closed

Aggregate functions in Field Calculator in modeller #25198

qgib opened this issue Oct 17, 2017 · 13 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Easy fix Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented Oct 17, 2017

Author Name: Danielle G (Danielle G)
Original Redmine Issue: 17300
Affected QGIS version: 2.18.14
Redmine category:processing/modeller
Assignee: Luigi Pirelli


The aggregate functions in field calculator cannot calculate on a layer which is not saved to the project model.

For example, when trying to do a series of aggregate (e.g. mean, sum) calculations in the model builder, the first one (working directly off of a layer saved in the model) will work, while any subsequent calculations, based on temporary layers within the model builder calculations returns "An error occurred while evaluating the calculation string: Cannot use aggregate function in this context".

(I haven't posted issues before, hopefully this is enough detail. It is very easy to replicate -simply try to do a couple of aggregate functions in series in model builder)


@qgib
Copy link
Contributor Author

qgib commented Oct 18, 2017

Author Name: Giovanni Manghi (@gioman)


  • category_id was changed from Field calculator to Processing/Modeller
  • subject was changed from Aggregate functions in Field Calculator to Aggregate functions in Field Calculator in modeller

@qgib
Copy link
Contributor Author

qgib commented Oct 31, 2017

Author Name: Francisco Pérez Sampayo (Francisco Pérez Sampayo)


I can confirm this bug on 2.18.14

@qgib
Copy link
Contributor Author

qgib commented Nov 2, 2017

Author Name: Giovanni Manghi (@gioman)


  • version was changed from 2.18.11 to 2.18.14

@qgib
Copy link
Contributor Author

qgib commented Dec 20, 2017

Author Name: Francisco Pérez Sampayo (Francisco Pérez Sampayo)


I just test this bug with master and works ok without problem on aggregates.
I send the layer and the models for the versions 2 and 3 i you want to replicate faster.


  • 11859 was configured as test_agg.model3
  • 11857 was configured as layer.zip
  • 11858 was configured as test_agg.model

@qgib
Copy link
Contributor Author

qgib commented Dec 22, 2017

Author Name: Luigi Pirelli (@luipir)


trying to replicate on linux

@qgib
Copy link
Contributor Author

qgib commented Dec 22, 2017

Author Name: Luigi Pirelli (@luipir)


replicated on linux with lates 2.18 b06f99b


  • assigned_to_id was configured as Luigi Pirelli

@qgib
Copy link
Contributor Author

qgib commented Dec 26, 2017

Author Name: Luigi Pirelli (@luipir)


proposed PR #5950


  • pull_request_patch_supplied was changed from 0 to 1

@qgib
Copy link
Contributor Author

qgib commented Jan 11, 2018

Author Name: Luigi Pirelli (@luipir)


changed assignee trying to speedup review or merge of proposed PR


  • assigned_to_id was changed from Luigi Pirelli to Victor Olaya

@qgib
Copy link
Contributor Author

qgib commented Jan 24, 2018

Author Name: Luigi Pirelli (@luipir)


Applied in changeset 1c34b25.


  • status_id was changed from Open to Closed
  • done_ratio was changed from 0 to 100

@qgib qgib closed this as completed Jan 24, 2018
@qgib
Copy link
Contributor Author

qgib commented Jan 30, 2018

Author Name: Jean-Louis Stanus (Jean-Louis Stanus)


Hello,

I tested with nightly 2.18.16-5 (installed with osgeo4w). It looks not solved.

I created

  • a model with refactor inwhich i use aggregate( ... input : merged_only_by_model
  • a second where i merge 2 layers THEN i refactor inwhich i use aggregate( ... input : couche2 and couche1

The first works, the second with the same layer not because refactor with aggregate is used in second (or more) place

UPDATE: yes, typo. Fixed ;)


  • 12063 was configured as aggregation_project_21816.zip
  • 12064 was configured as Models.zip

@qgib
Copy link
Contributor Author

qgib commented Jan 30, 2018

Author Name: Luigi Pirelli (@luipir)


I'll give a check, tnx for the report

I suppose it's a typo... you where talking about 2.18.16-5 is it right?


  • assigned_to_id was changed from Victor Olaya to Luigi Pirelli

@qgib
Copy link
Contributor Author

qgib commented Feb 2, 2018

Author Name: Luigi Pirelli (@luipir)


Hi Jean-Louis
The Aggregate function you are using in "test aggregate only" model is a "refactor fields" qgis alg that has not relation with aggregate functions. The only relation is the name that is set manually in the model.

The "test merge and aggregate" model depend on saga (that I've not installed) do you mind to prepare a test case that use ONLY base algorithm not depending by third party backends? I've error reading the algorithm because lack of SAGS.
BTW, merge algorithm is not (AFAIK) an aggregate function.

all this to say that your report seems related to something not related with the issue that has been fixed.

I leave the issue closed until a reproducible and related test case can confirm that the fix is not working.

regards

@qgib
Copy link
Contributor Author

qgib commented Feb 22, 2018

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was changed from 0 to 1
  • resolution was changed from to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms Easy fix labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Easy fix Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant