Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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

share|improve this answer
    
I guessed that there would be a simple expression, thanks Nathan –  geosmiles Jan 14 '13 at 12:05
    
when 1.9 rolls out? –  nickves Jan 14 '13 at 14:36
1  
1.9 is not being released. 2.0 is the next release hopefully in the next few months. –  Nathan W Jan 14 '13 at 22:33
add comment

You need to save the file, before the changes to precision are fully displayed.

share|improve this answer
2  
In QGIS Master, you also have to leave edit mode and/or close and reopen the attribute table. –  Andre Joost Jan 14 '13 at 10:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.