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 Export Layer to Shapefile on QGIS
QGIS,

How to Export Layer to Shapefile on QGIS

by adminSeptember 21, 2018no 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 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 (83)
  • Database (58)
  • Free Spatial Data (2)
  • General (6)
  • Geoserver (2)
  • GIS Software (23)
  • Global Mapper (20)
  • Leapfrog Geo (16)
  • Linux (9)
  • macOS (2)
  • Mapinfo (40)
  • Micromine (32)
  • Oracle (6)
  • Programming (8)
  • QGIS (105)
  • Software Review (2)
  • Surfer (2)
  • Uncategorized (6)

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trending

  • How to Install Microsoft SQL Server Driver for Tableau in Apple Silicon Mac

    How to Install Microsoft SQL Server Driver for Tableau in Apple Silicon Mac

    3 days ago
  • Step by Step Installing Oracle Spatial Studio on Windows Server 2022

    Step by Step Installing Oracle Spatial Studio on Windows Server 2022

    2 months ago
  • Install GeoServer on Windows 11

    Install GeoServer on Windows 11

    2 months ago
  • How Enable GeoRaster Support on Oracle Database Schema

    How Enable GeoRaster Support on Oracle Database Schema

    2 months ago

Ads




Ads




Pages