Interpolating Weather Station Data using the Smart-Map Plugin in QGIS

From CUOSGwiki
Jump to navigationJump to search

Introduction

This Tutorial is about using the smart map plugin to interpolate data about the earth. it can be used to interpolate soil properties climate data, or environmental variables. In this case we will be interpolating climate data for Nova Scotia for the month of July 2025. It uses ordinary kriging and the support vector machine (SVM) Algorithm as the two interpolation techniques for the Smart-Map plugin.

Setting up The Tutorial

This Tutorial uses QGIS 3.40 Long Term Release (LTR). If you have not downloaded QGIS, you can download it from the QGIS website by going to this link https://qgis.org/download/

The Smart-Map plugin only works on the LTR versions of QGIS. Ensure that the QGIS version used is the LTR version. Those are stable versions are for people who need reliability and stability without needing anything that is currently in development. If it is used on the development versions you will get value error of invalid literal for int() with base 10.

For this tutorial the Smart Map Plugin is required. To do this, go to Plugins > Manage and Install Plugins. A window will pop up showing all the available plugins. Search for the Smart Map plugin select it and then click install. Ensure that it shows experimental plugins as Smart-Map is an experimental plugin.

Smart-Map.png

You will need to download the smart-map files onto your computer in order for the plugin to work. You can download the files from the QGIS website. https://plugins.qgis.org/plugins/Smart_Map/

Data Preparation and Processing

An important part of interpolation is point data. You will need to download point data in order for interpolation to work. Interpolation is estimating an unknown value using a set of points with known values. It then generates a surface of predicted values for each pixel.

Go to https://climate.weather.gc.ca/ and go to Monthly Climate summaries. Download the summaries in csv format. Feel free to select a province, month, or year. For this Tutorial We will be doing the province of Nova Scotia for the month of July 2025.

Open the csv in excel to ensure that the right file is downloaded

In QGIS, go to Add layer > Add delimited text layer. Search for the table. Under Geometry types, select Longitude as the x value and latitude as the y value as seen below.

Delimited Text Layer.png

You will need to export the layer in order for processing for the Smart-Map plugin to work properly. Right click the layer and hit Export > Save Features as.. and a popup will appear. Make sure that a projected CRS is used because the smart map plugin can only interpolate data that uses a CRS. You can do this by selecting a different CRS. The UTM 17N zone was used because it is centred around the maritimes which includes NOva Scotia.

NS Layer Export.png

Once finished hit OK and you should get the layer in vector format

Using the Smart Map Plugin

Click on the Smart map Icon as highlighted below

Smart Map Icon.png

A window will pop up. For the input layer choose the climate summary layer. For the z layer, any variable can be chosen but in the example we will be doing Tx which is average daily maximum temperature. But feel free to select any variable of interest. Once the variable has been selected, hit import.

Climate Points Data.png

The second tab is the grid. You can adjust the pixel size as desired. The pixel size should be large so that the program will not crash. Ideally set the size at 1000 as shown below.

Climate Points Grid.png

The third tab is the interpolation. Adjust the maxinum distance and the h-value as desired and hit calulate when done. Adjust the variables and the model type as desired. With those variables, you can also change the maxinum distance and h-value to help lower the RMSe and increase the R2 value. Ideally you should aim for the highest possible R Squared and the lowest possible RSME. Hit interpolate when done

Climate Points Interpolation.png

When you hit highlighted, which is the button highlighted in light blue in the above image, you should get an output of something like this.

Smart Map OK Output.png

Alternatively you could also using the machine learning method. On the third tab under interpolation you can switch from ordinary kriging to machine learning.

Machine Learning.png

Once done hit interpolate and you should get an output of something like this.

Smart Map ML Output.png

For improved visualization, the raster should be clipped to the province so that it will be easier to convey the message.

Conclusion

This Tutorial showed how to use the smart map plugin in QGIS. This tutorial showed how to do both SVM and Ordinary Kriging on the Smart-Map plugin. It is a user freindly interface that has a unique machine learning interpolation called Vector Support Machine(SVM). While It is limited in scope, the process is relatively straightforward and interpolates the data with ease.

Sources

Pereira, G. W., Valente, D. S. M., Queiroz, D. M. de, Coelho, A. L. de F., Costa, M. M., & Grift, T. (2022). Smart-Map: An Open-Source QGIS Plugin for Digital Mapping Using Machine Learning Techniques and Ordinary Kriging. Agronomy (Basel), 12(6), 1350. https://doi.org/10.3390/agronomy12061350

Government of Canada. (2025, October 15). Monthly Climate Summaries. Climate. https://climate.weather.gc.ca/prods_servs/cdn_climate_summary_e.html

Van der Kwast, H. (n.d.). Interpolate points to rasters with kriging in QGIS using the Smart-Map plugin. YouTube. https://www.youtube.com/watch?v=-Vv1cAhiSVk