Bug report #10995

Virtual fields: graduated symbology with natural breaks does not use correct limits

Added by Giovanni Manghi over 10 years ago. Updated about 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Virtual Fields
Affected QGIS version: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 #:19338

Description

Steps:

  • pick a polygon layer
  • add a virtual field for area (two decimal places), like $area/10000 to get it in HA
  • clone the resulting column in a "real" column

now test the virtual field and the real column to make a graduated symbology using natural breaks: the ranges for the "real" field make sense while the ones for the virtual field seems wrong.


Related issues

Related to QGIS Application - Bug report #11000: QgsExpression target format Closed 2014-08-03

Associated revisions

Revision 7318c730
Added by Matthias Kuhn about 10 years ago

Convert values to target field format

For the field calculator and virtual fields.

Fix #11000
Fix #10995
Fix #10993

History

#1 Updated by Giovanni Manghi over 10 years ago

NOTE:
maybe because this issue, maybe because it seems that when doing symbology the decimals of the virtual field are ignored (it seems to use always the maximum number of decimals regardless the choice that was made when creating the field), I'm noticing that when doing graduated symbology based on VF (testing polygons and $area function) then sometimes there are features that do not render... but if you toggle editing then they render...

#2 Updated by Matthias Kuhn over 10 years ago

I do not understand the bug report, but I think it is related to #11000 like #10993.

#3 Updated by Giovanni Manghi over 10 years ago

Matthias Kuhn wrote:

I do not understand the bug report

  • pick a polygon layer and compute the $area of polygons in a field and a virtual field with 2 decimals
  • then do the graduated symbology using those fields, with natural breaks option
  • with the "real" field the classes are like

221832.3600 - 280204.1300
280204.1300 - 430749.4500
430749.4500 - 553529.0200

the graduated renderer always shows 4 decimals, but anyway the values are correct -> the ones in the "real" column

  • with the Virtual field the classes (natural breaks) are like

221832.3558 - 280204.1329
280204.1329 - 430749.4541
430749.4541 - 553529.0204

that is not correct because those are not the values that are in the column used for the symbology.

#4 Updated by Matthias Kuhn over 10 years ago

Thank you for the clarification.

So it is indeed the same problem that the precision is not taken into account when evaluating the expression. If #11000 is solved, this issue should neither show up any longer.

#5 Updated by Paolo Cavallini over 10 years ago

  • Subject changed from Virtual fields: graudated symbology with natural breaks does not use correct limits to Virtual fields: graduated symbology with natural breaks does not use correct limits

#6 Updated by Matthias Kuhn over 10 years ago

Hi Giovanni,

Could you test https://github.com/qgis/QGIS/pull/1535 to see if it fixes this problem?

#7 Updated by Giovanni Manghi over 10 years ago

Matthias Kuhn wrote:

Hi Giovanni,

Could you test https://github.com/qgis/QGIS/pull/1535 to see if it fixes this problem?

Hi Matthias, thanks for the patch!

I will not be able to test it in the next weeks... I will give it a try as soon as I can, if anyone hasn't looked at it before. Cheers!

#8 Updated by Matthias Kuhn about 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF