You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I use the Field calculator to create a virtual field with the area of some polygons, my first try resulted in 80% NULL values.
On further testing the results seem ok. Only difference I did was changing the Output field type from Whole number (integer) to Decimal number (real)
To test, (see screendump for output with both options)
open attached shp file with the 12 provinces of The Netherlands
set project crs to epsg:28992 + OTF, and data crs is also epsg:28992 (Amersfoort)
now open the Field calculator and create a new field / create virtual field and call it 'area'
as Expression use $area
click OK: as you can see only 3 polygons have an area value, rest has NULL
now open the Field calculator again and create a new field / create virtual field and call it 'area2'
BUT change the default output fieldtype to Decimal !!
as Expression use $area
click OK: now all provinces have an area value!
?? what goes wrong here. Or at least how should a normal user find out this behaviour?
Maybe after fixing, also change the default value of output to Real/Float?
Update: I found out that it is apparently a integer overflow problem. That is, only the 3 smallest provinces have a value...
And if I change the expression to $area/(1000*1000) (so from meters to square km), all give a valid result EVEN when I set the output type to integers. Off course because then the values are smaller.
But I also checked the error messages, but did not see anything.
Proposal:
give a clear/descent error message when a integer overflow takes place during calculation (popup?)
make floats the default when you create an expression (or text), so this problem does not occur for innocent users like me :-)
qgib
added
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Vectors
Related to general vector layer handling (not specific data formats)
labels
May 25, 2019
Author Name: Richard Duivenvoorde (@rduivenvoorde)
Original Redmine Issue: 14082
Affected QGIS version: master
Redmine category:vectors
Not sure how much this is related to #21270
But when I use the Field calculator to create a virtual field with the area of some polygons, my first try resulted in 80% NULL values.
On further testing the results seem ok. Only difference I did was changing the Output field type from Whole number (integer) to Decimal number (real)
To test, (see screendump for output with both options)
?? what goes wrong here. Or at least how should a normal user find out this behaviour?
Maybe after fixing, also change the default value of output to Real/Float?
Related issue(s): #20739 (relates), #21270 (relates)
Redmine related issue(s): 12622, 13209
The text was updated successfully, but these errors were encountered: