Saturday 27 August 2016

qgis - Manually Adding a Decimal Field to the Attributes Table


I am fairly new to QGIS and search as I might in the manual, training manuals and widely on the net I can't find an in-depth explanation of how to set up a Decimal Number (real) field in my attribute table properly.



I have a number of vector layers, each with a polygon on them. I need to add a decimal field to manually insert a rate per 1,000 of the population. The number is more than likely going to be between n.n and nn.n


I have tried all sorts of different width and precision figures, but either the field is too small to take the number, or it is large enough, but I can't get a decimal point in there. Does this mean that the decimal number is less than one?


When I have entered some information into the cell and pressed Enter the cell always reverts to NULL.


Please help!


Thanks


Andy



Answer



You can use "New Column" tool in attribute table of your layer.


Width represent the total number of digits. Precision represents the number of decimals


Examples:



Width 5 Precision 3



  • -2.001

  • 99.999


Width 3 Precision 1



  • 0.1

  • 1.2

  • 99.9



Width 20 Precision 9



  • 11123456789.123456789


If your calculations are getting NULL values, first try to save and refresh your table attribute.


If the problem persist, make sure that the output of your calculus is a number and not a text.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...