is there a simple way (without writing script or python skills) to auto calculate and auto populate length attribute in QGIS? When I add a new line feature in my layer, I'd like the attribute length to be calculated and populated as I complete the task of adding the line. Right now, I create all my geometry and then update existing field with $length in the Field Calculator.

1 Answer 1


You want the length to be displayed along your line and auto-update as you draw or edit the line? In this case, simply label your line with the expression length($geometry) For the attribute table, use Creating a Virtual Field - when you create a new field with the field-calculator, select virtual field and set the expression you like - e.g. length($geometry) . However, I have to toggle edit-mode, close- and re-open the attribute-table to see the updated values. Simply press the refresh attribute-table does not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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