This question already has an answer here:

In QGIS, I need to calculate the distance between certain points and save this information as a line shape file, in which the attribute of each element (line) is its length (distance between points).

For this I have created a temporary draft layer of lines to draw the lines and I have obtained this:

introducir la descripción de la imagen aquí

Now, how do I calculate the lengths and save them as an attribute of the elements?

marked as duplicate by ahmadhanb qgis Sep 11 at 14:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Open the attribute table of your draft layer of lines and create a new field with the field calculator. Use $length or length ($geometry) to calculate the length of the lines in your layer. Be careful what you measure: "You need to use a Projected Coordinate Reference System with units of meters or feet to perform such calculations"

  • Thank you very much for your help. – JVL Sep 11 at 16:04

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