Bug report #19091

v.vect.stats creates cat & cat_ then fails

Added by Simon Dedman over 1 year ago. Updated 7 months ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:Processing/GRASS
Affected QGIS version:3.0.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26921

Description

Grass processing toolbox element v.vect.stats counts point layer data within polygon areas layers & calculates statistics. If you want to calculate stats & counts for multiple fields in the points layer (e.g. you have data for various years) you have to repeat the process each time, selecting the layer and field, giving the resultant count & stats columns appropriate names, which produces a new polygon layer with the two new data fields appended, AND a field called 'cat'. If you use this new poly layer as the input for e.g. the next year's data, the output layer will already have 'cat' from the first run, so will create 'cat_'. The user likely doesn't care about these fields and there's no info presented during the process about that this is - it looks like a counter but I could very well be wrong. In any case: if you run the process a THIRD time, the code is defeated (presumably) because 'cat' is present so it tries 'cat_' which is also present, so it fails. Subsequently the user has to deduce that this is the problem with no help, then goto layer properties, source fields, edit, select cat & cat_, delete fields, unedit, save.

Proposal:
1. have an option in the dialogue box to create 'cat' field and explain what it is. Turned on by default.
2. Have cat field naming schema: cat0, cat1 etc, up to cat9999999 above which point it'll break the 10 character limit. Notwithstanding if you ran v.vect.stats 10 million times manually you'd experience the heat death of the universe before you hit the 10 character limit.

History

#1 Updated by Nyall Dawson over 1 year ago

  • Status changed from Open to Closed
  • Resolution set to up/downstream

This is an issue which should be fixed in grass itself, not qgis

#2 Updated by Simon Dedman over 1 year ago

#3 Updated by Simon Dedman over 1 year ago

  • Status changed from Closed to Reopened

Module dev Markus suggests the problem could be solved if QGIS uses "v.out.ogr -s" to skip export of GRASS category ID ('cat') attribute, and feasibly boils in the "-m" switch as well, though I'm not sure what that does.
These could be options but he seems to think that's unnecessary.

#4 Updated by Alexander Bruy 7 months ago

  • Resolution deleted (up/downstream)
  • Status changed from Reopened to Feedback
  • Operating System deleted (Win10)

Should be already fixed. Please test with master and latest 3.4.

Also available in: Atom PDF