This article is a simplified guide on how to calculate Rainfall Erosivity Factor using QGIS. Before we proceed, it’s important for us to mention a few points about Rainfall Erosivity Factor.

So we will explain what Rainfall Erosivity Factor is, why and when you need to calculate Rainfall Erosivity factor. Then we will move to the meat of the article which is how to calculate Rainfall Erosivity factor using QGIS.

Let’s get started!

Rain drop behaves like a meteor
Rain drop behaves like a meteor

What is Rainfall Erosivity Factor

Rainfall Erosivity factor, also called R factor, is an attempt to measure the capability of rainfall to cause soil erosion.

When a drop of rain water lands on the earth it behaves like a meteor. The drop of water makes the soil particles to scatter and loosen. Once the particles are loosened it is easy for the flood to wash the soil particles away.

If that is clear, let’s see a simple definition of Rainfall Erosivity factor by an expert:

The rainfall potential to erode soil is called rainfall erosivity (R factor) and is used to describe the characteristics of precipitation

-Yue, Shi & Fang, 2014

Why and when you need to calculate Rainfall Erosivity factor

Soil erosion, which is the gradual removal of the top layer of the soil, is a common land degradation problem. Researchers have however noted that soil erosion has increased in the 20th century. Therefore it is important for us to take steps against this environmental nuisance.

There are two agents of soil erosion, wind and water. Soil erosion by water is the stronger and more common of the two. Also, soil erosion by rainfall (precipitation) is the most important form of water erosion.

Three researchers from Universiti Pendidikan Sultan Idris, Malaysia mentioned that:

rainfall erosivity is of high importance as precipitation is the main driver for soil erosion by water and has a direct impact on the detachment of soil particles, the breakdown of aggregates and the transport of eroded particles via runoff[1]

No one is ignorant of the importance of soil to man. The quantity and quality of soil does not only affect the quantity of agricultural produce but it also determines the quality of agricultural produce. Therefore, increased soil erosion means lower quality and/or quantity of agricultural produce.

In extreme cases, soil erosion will not only reduce the quality of agricultural soil but it will make the soil completely unusable for agriculture.

Soil erosion can also damage roads and railway lines.

Soil erosion can pollute sources of domestic water. Rain water can dissolve and carry harmful chemicals from farmlands and industries to rivers and lakes. People or animals who drink such water will suffer from sickness and may result to death.

Our knowledge of R factor can help us make smarter decisions on soil preservation techniques. Once we identify areas that are susceptible to soil erosion by rain water it will be easy for us to research the cause and then take steps to reduce soil erosion to the minimum.

Governments, for example, can make stricter rules against indiscriminate felling of trees in such areas. As we know, vegetation cover protects the soil from the harsh impacts of rain-drops.

How to calculate Rainfall Erosivity factor using QGIS

Now that you understand what R factor is and its importance, let’s proceed to the main course of the meal; how to calculate Rainfall Erosivity Factor using QGIS.

What you need to calculate Rainfall Erosivity Factor

To calculate Rainfall Erosivity factor of any area on the earth you will need the following:

  • Rainfall data of your study area
  • Rainfall Erosivity Factor (R factor) Formula for your study area
  • Vector Polygon of your study area
  • A computer with QGIS installed on it
  • This tutorial
01 sinana precipitation data
Screenshot of Sinana precipitation data

Rainfall data

You need to get the rainfall data of your study area. Rainfall data is usually available on the official website of your country (or country-of-study’s) meteorological organization or association.

For the purpose of this tutorial, we’ll be making use of a dataset that I got it from Monde-Geospatial.

r factor formulae and their authors
Table showing R factor formula of selected countries

Formula for Rainfall Erosivity in your area of study

The Rainfall Erosivity formula is an equation that researchers created and use to calculate the R factor of a location. They studied various properties of raindrop in various parts of the world to create this equation. Some of these properties are the:

  • Intensity of rainfall in the area
  • Velocity of raindrops in the area,
  • Size of raindrops in the area, and
  • Kinetic energy of raindrops in the area.

These properties vary from country to country. Rather they vary even within a single country many times. Therefore, the R factor formula varies from country to country. As a result you need to search for the R factor formula of your study area before you can calculate your study area’s Rainfall Erosivity Factor using QGIS (or any other GIS software).

Below are some examples of Rainfall Erosivity Factor formulas. You can do a quick search on Google to get the formula for your area of study.

Vector Polygon of your study area

An easy way to get the vector polygon of your study area is to use the Natural Earth Quick Start Kit. Visit Natural Earth to get it. It has the shapefiles of states and Provinces of all countries in the world. You can visit the natural earth website here or click here to directly download the shapefile of this exercise.


02 add csv dialogue in qgis
dialogue box for adding CSV in qgis

Import your precipitation data to QGIS

Weather organizations usually give their precipitation and temperature data in CSV (comma separated values).

Your CSV will have at least three columns. Two for the locational data and one for the attribute data. Many climate and weather stations add a fourth column for the altitude attribute of the station where the data was collected.

The two columns of locational data are the longitude and the latitude columns. These two columns represent the location of the weather station that the data was collected from.

Then there will be a third (or more) table for your attribute data. The attribute data describes the locations. In our case, the attribute data is the mean annual precipitation (map) column.

To import your CSV to QGIS simply click on the  button on the left side of your screen. A dialogue box will appear. Click on the three dots beside the file name input box. Navigate to the location of your CSV and double click it.

Choose the longitude column as your ‘x field’ and the latitude column as your ‘y field’. The title of your column might be different. Just remember that ‘x field’ is for longitude and ‘Y field’ is for latitude.

Click on add. Your CSV should now be added to the QGIS interface as points.

Import the polygon of your study area

Simply navigate to the location of your shapefile. Then click and drag the .shp file to the qgis canvas. This post explains the details of how to add a shapefile to the QGIS canvas.

04 IDW interpolation menu in QGIS
IDW interpolation menu in QGIS

Interpolate your data (IDW)

Our layer is in points. We need to make the data cover our study area. To do this we will use the interpolation algorithm.

The interpolation algorithm estimates values for the area surrounding each point.

Go to processing »toolbox.

 A panel will show up on the right side of your screen. Type interpolation in the search box of the panel. You will see two types of interpolation: IDW and TIN. The IDW is the one we need. Double click it.

In the dialogue box that shows up, choose your point layer as the Vector layer. Select your mean annual precipitation (MAP) as the interpolation attribute.

Click on the button green-cross button . Leave the other settings in default. Click run in background.

05 interpolation output raster
Result of IDW interpolation

If you followed the above instructions well you should get the above result

07 output of clip algorithm
Output of clip algorithm

Clip output raster to polygon of study area

The output raster is a rectangle but our study area is not a rectangle. Now we need to carve out our study area from the rectangle. This process is what we call clipping in GIS.

Navigate to Raster » extraction » clip raster by mask layer. In the dialogue box that appears enter the output raster of the interpolation algorithm as your input layer. Select the polygon of your study area as the mask layer.

Ensure you tick the “open output file after running algorithm” checkbox.

Click run in background. The image above is the output.

08 calculate r factor in qgis raster calculator
calculate r factor in qgis raster calculator

Calculate your R factor

The next and most important step is to calculate the rainfall Erosivity factor for our study area. To do this we will use the raster calculator.

Remember that a raster file is made of pixels. Also each pixel has a value.

Now, what the raster calculator does is use the value of each raster pixel in a formula that you give it. Then it will produce an output raster. The value of the output raster’s pixels will be the result of the formula you put in the raster calculator.

Navigate to raster» raster calculator. Type the Rainfall Erosivity Factor (R factor) formula for your study area in the space provided. In our case we are calculating R factor for Ethiopia so we will be using the following formula:

R factor = 0.55*(MAP) – 24.7

Remember that MAP means Mean Annual Precipitation.

Do not forget that our clipped raster contains rainfall data. Now, we’ll tell QGIS that the values of that raster layer’s pixels is the MAP in the equation. So, you should replace MAP with the value of your raster pixels. Highlight MAP in the equation and DoubleClick the band of your clipped raster layer. Your result should be like the screenshot below

08 calculate r factor in qgis raster calculator
calculate r factor in qgis raster calculator

Click on the three dots button to select a directory and name for your output layer. Once you have done that click on OK. You should get a raster output like the one below:

R factor output raster
Final Styled output raster of R

Style your output raster

Now we need to give our output raster a beautiful and intuitive colour.

Right click on the output layer of your raster calculator. Click on properties. Select the symbology tab. Click the ‘Render Type’ drop down menu and choose singleband pseudocolor. Leave the interpolation to linear. Choose a colour ramp of your choice and click ‘apply’.

The above image is my final result


I hope you have successfully learnt how to calculate Rainfall Erosivity factor using QGIS. If you followed this guide step-by-step you shouldn’t have any problem.

I’d really appreciate it if you tweet me your R factor map or share it with me on my facebook page.

Do you need help with any GIS analysis? Talk to an expert

Thanks for reading and kindly subscribe to get more cool QGIS tutorials.


Notes and References

[1] A Review on Rainfall Erosivity (R factor) in Universal Soil Loss Equation. Mohamad Nazuhan, Zullyadini A. Rahaman & Zainuddin Othman. Department of Geography and Environment, Faculty of Human Sciences Universiti Pendidikan Sultan Idris, Malaysia. International Journal of Academic Research in Business and Social Sciences.

Leave a Reply