GIS Tutorial
  • Home
  • About
  • Contact

Popular Posts

How to open Mapinfo TAB file on QGIS
QGIS,

How to open Mapinfo TAB file on QGIS

by adminJanuary 1, 20181 comment
How to Create a GeoPackage on QGIS 3.2
QGIS,

How to Create a GeoPackage on QGIS 3.2

by adminJuly 25, 2018no comment
How to Export Layer to Shapefile on QGIS
QGIS,

How to Export Layer to Shapefile on QGIS

by adminSeptember 21, 2018no comment
How to convert polyline to polygon on QGIS 3.0
QGIS,

How to convert polyline to polygon on QGIS 3.0

by adminJune 12, 2018no comment

Category List

  • ArcGIS (75)
  • Database (34)
  • Free Spatial Data (2)
  • General (5)
  • GIS Software (20)
  • Global Mapper (20)
  • Leapfrog Geo (15)
  • Mapinfo (40)
  • Micromine (28)
  • Programming (2)
  • QGIS (98)
  • Software Review (1)
  • Surfer (2)
  • Uncategorized (4)

Follow Us

Instagram

Instagram has returned invalid data.
GIS Tutorial
  • Home
  • About
  • Contact
QGIS,

How to Calculate Length in QGIS

by adminNovember 30, 20182 comments
2
Shares
Share on FacebookShare on Twitter
contour layer

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

$length

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.

Final Words

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.

qgis tutorial
Previous

Step by Step Guide to Install PostGIS on Ubuntu 18.10

November 30, 2018
Next

How to Merge Vector Layers on QGIS 3.2

December 1, 2018

2 Comments

Stu Smith

October 8, 2019

Thank you. The two methods you use generate different distance values. Looking at your last screenshot, I see that Length and length_2 contain different results. Why?

Reply

admin

October 8, 2019

Hi Smith.. I think the two calculation was made with different projections

Reply

Leave a Reply Cancel reply

Trending

  • How to Extract Raster Value to Point Layer in ArcGIS Pro

    How to Extract Raster Value to Point Layer in ArcGIS Pro

    3 weeks ago
  • How to Convert 5 GB Tiff into JPEG Easily

    How to Convert 5 GB Tiff into JPEG Easily

    3 weeks ago
  • Finally, I Can Run Oasis Montaj on My Macbook Pro M1

    Finally, I Can Run Oasis Montaj on My Macbook Pro M1

    3 weeks ago
  • How to Run ArcGIS Pro on Macbook Pro M1 and M2

    How to Run ArcGIS Pro on Macbook Pro M1 and M2

    4 weeks ago
  • ArcGIS
  • Database
  • Free Spatial Data
  • General
  • GIS Software
  • Global Mapper
  • Leapfrog Geo
  • Mapinfo
  • Micromine
  • Programming
  • QGIS
  • Software Review
  • Surfer
  • Uncategorized

Ads




Ads




Pages