Bug report #19355
$length incorrect in expressions
|Affected QGIS version:||3.5(master)||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27183|
$length correctly calculates ellipsoidal length in a field calculator update, but shows planimetric length in the expression dialog and if used in expressions elsewhere, such as in labels.
Fix $length in labels (fixes #19355)
Use the project expression scope to access project
parameters (ellipsoid and distance/area units)
#1 Updated by Borys Jurgiel about 1 year ago
- Operating System deleted (
- Priority changed from Normal to High
This bug is definitely high priority, and misleading labels can be even considered as indirect data corruption.
On every training I teach users how to deal with this long standing issue, what becomes a bit embarrassing... :)
#2 Updated by Hugo Mercier 12 months ago
- File qgis_length_bug.png added
- Affected QGIS version changed from 3.2 to 3.5(master)
- File test_length.qgz added
- File test_length.gpkg added
Attached a sample project to reproduce, with one virtual field "length" with expression "$length" and labels using "$length || ' - ' || length"