Bug report #11938

Wrong $length

Added by Paolo Cavallini about 9 years ago. Updated over 7 years ago.

Category:Field calculator
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20146


The calculation of $length on the attached file returns weird results:
when calculated as virtual field is ok, whereas when updating an existing field a negative result is given. I assume this is related to topological errors in the line, but nevertheless the diff between the two methods is unexpected.

test_length.tar.gz (3.46 KB) Paolo Cavallini, 2015-01-04 04:37 AM


#1 Updated by Giovanni Manghi about 9 years ago

  • Affected QGIS version changed from 2.6.1 to master

The geometry errors do seem to be the cause of the issue, remove them and it will not change anything.

Computing (and updating) the length in any double field created by QGIS will return right values. On the other hand the existing field in the attached vector has a length that QGIS do not allow (when you create a column). Maybe is the inability of QGIS to handle fields with such lengths.

#2 Updated by Nyall Dawson over 7 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Not reproducible on master

Also available in: Atom PDF