Select and calculate features according to area, length and perimeters in QGIS. Let us explore some selection technique and also how to use calculation in QGIS. To calculate these parameters we have to change the unit of the calculation to meters. If the layers are in WGS84 CRS we will get measurement in degrees, so first we have to change the CRS of our layers as well as our project. You can also look over other tutorials in QGIS.
To do this, we will import the vector layers which are in projected CRS and change the project CRS by changing project properties. For this map we have selected WGS 84/ UTM Zone 43N CRS you can select zone as per your region.
Select and calculate area, length and perimeters of features
Let us select the features which have area greater than 1000 meter square and save these features into different layer. To complete this task we need to implement following steps:
1.) Open QGIS and open a polygon shapefile layer in QGIS. Select the opened layer for which you want to calculate area.
3.)Find $area by going into geometry and select it by double clicking on it.
4.) Set the query as shown in image. Click select and then close.
Select Within Selection Filter
1.) Now we want our selection to be more specific. We don’t want grounds in our selection but only buildings specifically which are university teaching department. To do this, lets implement steps.
2.) Again open select feature using expression tool. We will go to fields and values and select amenity. On clicking it we will get all unique values in the amenity field. We set the query as shown in the image.
3.) Don’t click on select instead click on drop-down near it and click select within selection and then close.
5.) This selected layer can be saved as another file by just Right click on the layer and click save as.
Calculate Length of features
There are many ways to calculate these Length, area, perimeter etc parameters. It depend on us which way we select. The result will be the same all the time. Let us check them one by one.
1.) Open the attribute table of the roads layer and then Click on the field calculator.
2.) You will find three options to calculate and take a look on values, as follows:
- Create a new field: A new field will be created and editing will be automatically enabled so that you can save the new field.
- Create a virtual field: A new field will be created and editing will be automatically enabled so that you can save the new field, and if you don’t want to save it will automatically delete the column when you close the attribute table.
- Update existing field: This will update the existing field with the new data.
3.) Set the calculator as shown in image. Click OK and take a look at the attribute table.
5.) Now let’s calculate length with another method. Click on toggle editing tool in the attribute table. Then click on new column.
7.) Now again click on the field calculator and click on the update existing field, select length from the Drop-down menu.
12.) Now you can calculate the length by selecting $length. Click ok. You will see the column is not updated.
15.) If you want to calculate length for a particular feature only for example length of primary roads only so first select the row which contains primary roads and then calculate length and then click on the button update selected.
Similarly you can select filter features and also calculate length, area, perimeter etc in QGIS. If you are getting any problem in following the steps provided, do comment below with the problem statement. This will let us to discuss over it.