Welcome to QGIS Tutorial. Today, I am going to show you how to calculate length in QGIS. QGIS has many tools that can be used for various purposes. In this example, I am going to calculate the length of every feature in a contour layer. Basically, I want to add a new field or column to the attribute table that contains length information of each features/lines in a layer.
Here is my contour layer
As you can see there are many contour lines in this layer. It is almost impossible to manually measure or calculate each contour lines. There is a smart way in QGIS to calculate length. Let’s do it.
Before we do the calculation, it is recommended to change project’s CRS to projected coordinate system, for example UTM. To do this, go to Project | Properties | CRS.
There are two ways (at least that’s what I know) to calculate length in QGIS. First, is using Field Calculator and the second one is using the Add Geometry attribute toolbox.
Calculate Length using Field Calculator
Open Field Calculator from the attribute toolbar.
There are several options here. We can create a new field to store the length information for each features. Or, we can also update existing field. In this case, I want to create a new field called “Length”. And then type
in the Expression box. Hit OK when ready. Next, open the attribute table and you will see the length of each features.
Calculate Length using Vector Geometry Tool
Open the Toolbox and then go to Vector Geometry | Add geometry attributes
Select the input layer and the projection. In this example, I use the Project CRS for calculation. Hit Run to start the process. It will create a new temporary layer called Added geom info. Open the attribute table of this layer and you will see another column with length information.
Calculate length of a layer is very easy to be done in QGIS. This is an important feature that not many GIS software have. Thanks for reading and hope you enjoy it.