Bug report #20058

$area show wrong values in labels

Added by Roberto Uhlig over 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Labelling
Affected QGIS version:3.3(master) Regression?:No
Operating System:Win7 64bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:27880

Description

Hi core-Dev's and community!
Thanks for fixing Ellipsoid $area calculation.

Now I'm trying to label my feature's with that calculated value(s) but I'm getting wrong results.

The attached SHP.zip (3ha_on_epsg_5350) has nearly exact 3ha on Ellipsoid GRS1980 as shown in the derived identify results panel.
The derived value for Area (Ellipsoidal, GRS80) is as expected 30000,492 m².

If I like to get this as label using single labels and expression dialog using $area the output preview shows my expected calculation 30000.492459927238 m².
But if I use this expression the label is shown wrong as 29994.923289153445.
If I go back to expression dialog the output preview now shows 29994.890625.

Please, if you can confirm my observations fix this also.
Thanks in advance!

QGIS version 3.3.0-Master
QGIS code revision 9ccb1b579b
Compiled against Qt 5.9.2
Running against Qt 5.9.2
Compiled against GDAL/OGR 2.2.4
Running against GDAL/OGR 2.2.4
Compiled against GEOS 3.6.1-CAPI-1.10.1
Running against GEOS 3.6.1-CAPI-1.10.1 r0
PostgreSQL Client Version 9.2.4
SpatiaLite Version 4.3.0
QWT Version 6.1.3
QScintilla2 Version 2.10.1
PROJ.4 Version 493
This copy of QGIS writes debugging output.

SHP.zip - 3ha_on_epsg_5350 (2.34 KB) Roberto Uhlig, 2018-10-09 08:18 AM

History

#1 Updated by Roberto Uhlig over 5 years ago

Please can anyone correct my typo in the title/theme field to the correct $area and remove the wrong §area.
I can't do it myself.
Thanks again in advance!

#2 Updated by Giovanni Manghi over 5 years ago

  • Subject changed from By labeling with §area somthing goes wrong to $area show wrong values in labels

#3 Updated by Roberto Uhlig over 5 years ago

Thanks for correcting my typo and for precising the title/theme.

#4 Updated by Roberto Uhlig about 5 years ago

  • Assignee set to Hugo Mercier

It looks like that the fix of #19355 also solved this bug.
If you can confirm I will close it.

By the way. The value of the output preview seems to become very different initialisations when expresssion dialog is (re)opened.
If it's the first opening it's empty. If expression is wrong or correct it's an error hint or the correct result of the expression (taken from first? feature).

In case of lable by expression, if I reopen the expression dialog where I defined a valid expression times before, the value of the output preview is wrong.
It should be empty or show the correct result of the expression.

Also, in case of lable by expression $area is a valid expression, in case of select by expression is (which is an other context) not (here it has to be e.g. $area>100 ...)

#5 Updated by Hugo Mercier about 5 years ago

Roberto Uhlig wrote:

It looks like that the fix of #19355 also solved this bug.

I think so yes.

By the way. The value of the output preview seems to become very different initialisations when expresssion dialog is (re)opened.
If it's the first opening it's empty. If expression is wrong or correct it's an error hint or the correct result of the expression (taken from first? feature).

In case of lable by expression, if I reopen the expression dialog where I defined a valid expression times before, the value of the output preview is wrong.
It should be empty or show the correct result of the expression.

Also, in case of lable by expression $area is a valid expression, in case of select by expression is (which is an other context) not (here it has to be e.g. $area>100 ...)

Look like bugs to me. Could you perhaps close this one and reopen new tickets that describe each other issues separately ?

#6 Updated by Roberto Uhlig about 5 years ago

  • Status changed from Open to Closed
  • Assignee changed from Hugo Mercier to Paolo Cavallini

Thanks for fixing this.
New Bug-Reports will follow ;-|

So I suggest to put this fix also to the Notable Fixes Section of Hugo Mercier
http://changelog.qgis.org/en/qgis/version/3.6.0/#bug-fixes-by-hugo-mercier

#7 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to fixed/implemented
  • Assignee deleted (Paolo Cavallini)

Also available in: Atom PDF