Thursday, 23 March 2017

qgis - How to change length to 2 decimal places?


I'm trying to work out how to calculate the length of a line to only 2 decimal places in QGIS. When I use the field calculator to create a new field, it doesn't matter what changes I make to the field type, field width or precision, I continually get the length to 13 decimal place.



Answer



In the latest dev QGIS version there is a new round function which you can use to control the number of decimal places:


round($length,3)

Result: 1.10228762876525 -> 1.102



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...