Difference between revisions of "Creating IDW and Spline Interpolation Maps Using QGIS"

From CUOSGwiki
Jump to navigationJump to search
 
(93 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
== Learning Outcomes of this Tutorial ==
 
== Learning Outcomes of this Tutorial ==
   
  +
By the end of this tutorial, you will be able to perform the following tasks within ''''Quantum' GIS''' ([http://en.wikipedia.org/wiki/QGIS QGIS]):
Performing the following tasks within ''''Quantum' GIS''' ([http://en.wikipedia.org/wiki/QGIS QGIS]): Importing point data files (shapefile, CSV); importing satellite imagery basemaps; labeling point data using attribute information; creating interpolated raster surfaces using IDW and spline interpolation methods, symbolizing the interpolated raster surfaces, clipping raster surfaces with digitized polygons, and exporting the raster surfaces as a finished map.
 
  +
*Importing point data files (shapefile, CSV)
  +
*Importing satellite imagery basemaps
  +
*Labelling point data using attribute information
  +
*Creating interpolated raster surfaces using (IDW Inverse Distance Weight) and spline interpolation methods
  +
*Symbolizing the interpolated raster surfaces
  +
*Clipping raster surfaces with digitized polygons
  +
*Exporting the raster surfaces as a finished map
   
 
== Purpose ==
 
== Purpose ==
  +
The purpose of this tutorial is to introduce users to IDW and Spline [http://en.wikipedia.org/wiki/Interpolation interpolations], using several tools and plugins within QGIS, with the goal of creating interpolation maps.
   
  +
[https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/idw.htm IDW] uses the measured values surrounding the prediction location to predict a value for any unsampled location, based on the assumption that things that are close to one another are more alike than those that are farther apart. For more information on IDW visit [https://pro.arcgis.com/en/pro-app/latest/help/analysis/geostatistical-analyst/how-inverse-distance-weighted-interpolation-works.htm How IDW works].
The purpose of this tutorial is to show users how to perform Inverse Distance Weight (IDW) and Spline [http://en.wikipedia.org/wiki/Interpolation interpolations], using several tools and plugins within [http://en.wikipedia.org/wiki/QGIS QGIS], with the goal of creating finished interpolation maps. For the knowledge level of this tutorial, it is assumed that the user has some experience with GIS systems, whether it be from commercial products such as ESRI ArcMap or MapInfo or from open source packages such as QGIS, GRASS GIS, etc. However, this tutorial incorporates screen-shots for each step of the procedures and should be easy to follow along to.
 
  +
  +
[https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/spline.htm Spline] Interpolates a raster surface from points using a two-dimensional minimum curvature spline technique. The resulting smooth surface passes exactly through the input points.
  +
  +
IDW and Spline interpolations are similar in that they are methods that create surfaces based on similarity of the data or the degree of smoothness. However, spline differs from IDW in that it passes through each sample point. IDW does not pass through any points.
   
 
== Introduction ==
 
== Introduction ==
  +
[https://qgis.org/en/site/ QGIS] is a free and open source [https://en.wikipedia.org/wiki/Geographic_information_system#:~:text=A%20geographic%20information%20system%20%28GIS%29%20is%20a%20type,for%20managing%2C%20analyzing%2C%20and%20visualizing%20those%20data.%20 geographic information system (GIS)] that is developed and supported by thousands of users and organizations around the world. It's core features include a suite of vector and raster tools that are compatible with many of the most popular geospatial file formats.
   
The purpose of this project was to explore toolsets and applications within different ‘open source’ geographic information system (GIS) programs. The term ‘open source’ refers to the fact that all of these programs are free of charge to use, compared to more commonly known/taught (and usually more user friendly) commercial packages such as [http://www.esri.com/software/arcgis/arcgis-for-desktop ArcGis], which have costly license subscriptions. For a good listing of open course GIS programs available for download, visit the [http://opensourcegis.org/ Open Source GIS] page. This tutorial was completed as a partial requirement of the GEOM-4008 GIS course at Carleton University as the final course project. For a complete list of other tutorials created for this course by students in the past, visit the [http://gracilis.carleton.ca/CUOSGwiki/index.php/Main_Page CUOSG page].
+
This tutorial was completed as a partial requirement of the GEOM-4008 GIS course at Carleton University as the final course project. For a complete list of other tutorials created for this course by students in the past, visit the [https://dges.carleton.ca/CUOSGwiki/index.php/Main_Page CUOSG page].
   
  +
This tutorial incorporates step-by-step instructions and screenshots for each procedure which should be easy to follow along at any skill level.
== Data ==
 
   
  +
== Open Source ==
The dataset being used for the purpose of this tutorial is a lake water geochemical dataset, consisting of 25 sampled locations on Frame Lake ([http://en.wikipedia.org/wiki/Yellowknife Yellowknife], North West Territories), provided by the [http://http-server.carleton.ca/~tpatters/index.html Patterson Research Group] at Carleton University. This dataset is comprised of measured concentrations of major chemical elements (in PPM) and trace elements (PPM and PPB). The purpose of collecting this data was to map the concentration distributions of harmful elements, such as As, Pb, Hg and Cr within the lake, in order to determine which parts of the lake need the most remediation work done before trying to reintroduce fish populations into the lake.
 
   
  +
The term ‘open source’ refers to accessible, free and redistributable programs available to the public. Compared to more common commercial packages such as ArcGIS, which have costly license subscriptions, open source programs like QGIS are free of charge to use. Additionally, open source programs and data allows individuals to work together to code. This type of model encourages open collaboration. If you would like, feel free to look at available open source technology at [https://www.osgeo.org/choose-a-project/ OSGeo].
However, this is unpublished scientific research data and therefore cannot be shared yet. However, any point data-set can be used for the purpose of this tutorial, so long as the points have a geographic location and an attribute that can be used for the interpolation (elevation, chemical concentration, precipitation measurements, etc). Some good sources of data that can be used for this tutorial include: [http://www.geobase.ca/ Geobase], [http://www.geogratis.gc.ca/geogratis/Home?lang=en Geogratis], [http://data.geocomm.com/ GIS Data Depot] and [http://freegisdata.rtwilson.com/ Free GIS Data ].
 
   
 
== About QGIS ==
 
== About QGIS ==
  +
[[File:QGISlogo.png|frame|center]]
  +
As described on their website, QGIS is a "A Free and Open Source Geographic Information System", and the latest version of the software (v3.26 Buenos Aires as of September 2022) is available for download on their [https://www.qgis.org/en/site/ Official Website]. Similar to other GIS platforms it can be used to edit, create, visually represent, analyze and export a variety of geospatial data and it is licensed under the GNU General Public License. QGIS is an official project of the [https://www.osgeo.org/ Open Source Geospatial Foundation (OSGeo)]. It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.
   
  +
=== Installing QGIS ===
As described on their website, '''QGIS''' is a "A Free and Open Source Geographic Information System", and the latest version (v2.6) of the software is available for download on their [http://www.qgis.org/en/site/ Official Website]. Like other GIS platforms it can be used to edit, create, visually represent, analyze and export a variety of geospatial data and it is licensed under the GNU General Public License. QGIS is an official project of the [http://www.osgeo.org/ Open Source Geospatial Foundation] (OSGeo). It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.
 
   
  +
There are several versions of QGIS available for download. For the purposes of this tutorial, we will be using the long-term release version (QGIS 3.22).
[[File:QGISBanner.png|200px|thumb|left]]
 
  +
*Follow this link [https://qgis.org/en/site/forusers/download.html QGIS Download] to the QGIS site.
  +
*Ensure that you are on the “Installation Download” tab.
  +
**There are three versions of the QGIS installer available in this tab. The first is a network installer which is not needed for our application, the other two are the latest release (Version 3.26) and the long-term release (Version 3.22). We will be using the long-term release because it provides the most stability and is more widely used due to it receiving minor updates less frequently.
  +
[[File:QGISdl.png|center]]
   
  +
*The slightly older version of QGIS that will be used for the purpose of this tutorial is v.3.22, which can be downloaded by clicking this [https://qgis.org/downloads/QGIS-OSGeo4W-3.22.11-1.msi link].
  +
*Once you have downloaded the software from the QGIS website, follow the step-by-step installation instructions on your computer. After the QGIS v.3.22 LTR is downloaded and ready to execute, double click the QGIS shortcut icon on your Desktop or search for it in the Start Menu. The QGIS window opens, and we are ready to begin.
   
  +
== Example 1 IDWs of Chemical Concentrations==
  +
=== Data ===
  +
The dataset selected for the purpose of this tutorial is publicly available from the Government of British Columbia (GoBC) from the [https://open.canada.ca/data/en/dataset/49a73c36-4a25-4be5-b6d1-abd020fb031a Regional Geochemical Survey]. The joint federal-provincial Regional Geochemical Surveys (RGS) have been carried out in British Columbia since 1976 as part of the National Geochemical Reconnaissance (NGR) program to aid exploration and development of mineral resources. The British Columbia Geological Survey (BCGS) maintains provincial geochemical databases capturing information from multi-media surveys. The latest release (as of September 2022) augments the database with new RGS data compiled from BCGS and Geoscience BC publications between 2016 and 2019. For more information visit the [https://www2.gov.bc.ca/gov/content/industry/mineral-exploration-mining/british-columbia-geological-survey/geology/regional-geochemical-survey Regional Geochemical Survey Page].
   
  +
This tutorial uses data provided by the GoBC. However, any point dataset can be used for the purpose of this tutorial, as long as the points have a geographic location and an attribute that can be used for the interpolation (elevation, chemical concentration, precipitation measurements, etc).
   
  +
=== Downloading the Data ===
  +
#Go to the [https://open.canada.ca/data/en/dataset/49a73c36-4a25-4be5-b6d1-abd020fb031a Regional Geochemical Survey Data Page], scroll down to the Data and Resources section and click download to the right of the 2020 database Excel file labeled RGS2020 data. [[File:RGSdl.png|500px]]
  +
#It is recommended that you also download the metadata file associated with the data if you would like to know an explanation of the various headings.
  +
#We will also be using a boundary shapefile to create the extent of the survey data’s raster from [https://open.canada.ca/data/en/dataset/306e5004-534b-4110-9feb-58e3a5c3fd97 Administrative Boundaries in Canada], Download the Prepackaged Shapefiles then add the ‘geo_political_region_2’ files to your project folder. <br />[[File:Canadabnddl.png|500px]]
   
  +
=== Editing the Data ===
  +
This data has very large amounts of variables. As such we need to edit it to make it easier to work with:
  +
#Open the Excel file (or other spreadsheet software- if opening a CSV file make sure that you select "separated by a comma" to format the file correctly).
  +
#Beginning with the variable to include in the set, in this case we are using arsenic concentration in parts per billion (ppb) in filtered, acidified water by ICP-MS.(As_ppb). Use the metadata file to locate the chemical concentration of interest and delete all other variables not dealing with location or identification.
  +
#Once you have done this save your data as a CSV file (File, export, change file type, CSV, Save As) and you are ready to bring them into QGIS.
   
  +
=== Adding a Base Layer ===
  +
#Launch QGIS once you have installed it on your computer and downloaded a suitable dataset to work with.
  +
#At the top of your toolbar, click the plugin tab and click the "manage and install plugins" item.
  +
#In the "all" tab, search for the " HCMGIS" plugin and install it to QGIS. Once this is done restart QGIS.
  +
#Once you are back into a new project layer, click the HCMGIS tab at the top and go to the BaseMap dropdown and select ‘Bing Virtual Earth’.
   
  +
=== Specifying a Project Projection ===
  +
You will also need to specify a [https://en.wikipedia.org/wiki/Projected_coordinate_system#:~:text=A%20projected%20coordinate%20system%2C%20also%20known%20as%20a,surface%20created%20by%20a%20particular%20map%20projection.%20 projected coordinate system] for the project and shapefiles, in order to run interpolations on the data’s output shapefile in later steps. For North American datasets, one would commonly use the NAD83 [https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system UTM] projections, making sure to select the correct UTM zone for the map area of your dataset. However, for the British Columbia dataset used in this tutorial, NAD83 / BC Albers was chosen for the projection, as it is a [https://ibis.geog.ubc.ca/~brian/Course.Notes/bceprojection.html British Columbia Environment Standard Projection].
  +
#Use Ctrl+Shift+P.
  +
#In the CRS tab search ‘BC’.
  +
#Click NAD83 / BC Albers under projected coordinate systems then click ‘OK’.
  +
[[File:ProjectionBCAlbers.png|500px|center]]
   
  +
=== Loading CSV File Data and Provincial Boundary File ===
  +
There are two simple ways to import the point data into QGIS, depending on the type of data that you downloaded (shapefile, CSV file, excel spreadsheet). If your data is in the form of an Excel spreadsheet (where the points have associated latitudes, longitudes and attribute data), save it as a [https://en.wikipedia.org/wiki/Comma-separated_values comma-separated value (CSV)] file before trying to import it into QGIS.
  +
#Create a New Empty Project.
  +
#To import a CSV file, click on the ‘Layer’ tab in the upper left-hand corner of the screen, and select the ‘Add Delimited Text Layer’ tab.<br />[[File:CSVtoVec.png|500px|center]]
  +
#A window will then prompt you to navigate to your saved CSV file on your hard drive. It is recommended to create a space where you will be saving all your files and file layers (creating a new folder to keep everything in to keep all paths the same for the project is recommended).
  +
#Assign a layer name for the output point data, for this tutorial ‘rgs2020_data’ was assigned. Select the ‘longitude’ field to represent the x-values and the ‘latitude’ field to represent the y-values. You may be also prompted to provide a map projection for the data. If so, select the appropriate [https://en.wikipedia.org/wiki/Geographic_coordinate_system geographic coordinate system] for your dataset, such as [https://confluence.qps.nl/qinsy/latest/en/world-geodetic-system-1984-wgs84-29855173.html WGS-84] or [https://en.wikipedia.org/wiki/North_American_Datum#North_American_Datum_of_1983 NAD-83]. Then click ‘Add’ on the right-hand side to load the xy point data.[[File:CSV2.png|500px|center]]
  +
#The next step when loading a CSV file is exporting the loaded point data (from the previous step) to a shapefile. To do this in QGIS, right-click on the loaded point data layer and click export "save feature as".[[File:CSV3.png|500px|center]]
  +
#A window will then prompt you to pick the format of the file being saved, choose ‘ESRI Shapefile’. Browse for a location to save the shapefile on your hard drive and assign the filename RGS_data' for the output shapefile. Make sure the check box for ‘Add saved file to map’ is checked. Then click ‘OK’
  +
#For the provincial boundary shapefile click on the layer tab at the top of the page go to the "add layer" tab and scroll to the "add Vector layer" tab.
  +
#In the new window, click the 3 dots at the top right corner of the screen (you will be finding the boundary file we downloaded) in the package you downloaded click the file with the .shp end to it and add it to your project.
  +
#Once it is loaded right-click on the layer and select "Open attribute table"
  +
#Once open, click the pencil at the top left of the window to toggle editing.
  +
#Then select all layers besides those labelled British Columbia and click the "delete selected feature" (red trashcan).
  +
#Once this is complete you should have the RGS data layer, the British Columbia boundary layer, and the base map layer in your project layers from top to bottom. It should look like the image below. <br /> [[File:Sofar1.png|500px|center]]
   
  +
=== Creating the IDW Interpolated Raster Surfaces ===
  +
Before creating the IDW layer the data should be cleaned, first, we need to select all areas with water with valid arsenic concentration levels (i.e. > 0): to do so, follow these steps:
  +
#Right click on the RGS_data layer and open its Attribute table.
  +
#Click on “Select features using an expression”.
  +
#In the window, write the following expression: "As_ppb" > 0, and then click “Select features”.
  +
#Invert Selection using Ctrl+R, edit the selection with Ctrl+E and delete the selected features.
   
  +
[[File:Attrib1.png|500px|center]]
   
  +
Now that we have selected all the survey areas with arsenic concentrations greater than 0, we can proceed with the IDW interpolation.
   
  +
#Click on the ‘Processing’ tab and select ‘Toolbox’ or Ctrl+Alt+T. Search IDW. You will notice that QGIS draws tools from different GIS sources (GDAL, GRASS, SAGA, etc.) including its own QGIS tool selection. If you use the IDW tool from GRASS or GDAL, it will provide more options including how many sampling points to be used, radius distance, cell size, etc. compared to default QGIS IDW Interpolation tool which only allows specifying the P value, and number of output rows and columns. For this tutorial we will use the protectory software provided by QGIS.
  +
#Click on the IDW interpolation tool from QGIS.
  +
#The IDW input window will then appear, which allows you to input the data layer being interpolated and customize the interpolation based on your needs. For the ‘Vector layer’ input use the ‘RGS_data’ shapefile layer.
  +
#Next, specify the Interpolation attribute, which is the field value to be interpolated. The map we are making deals with arsenic concentration levels so chose the corresponding field, ‘As_ppb”. Click on the ‘+’ sign to add the attribute.
  +
#The Extent will be the BC boundary, choose the ‘calculate from layer’ dropdown, then choose the ‘geo_political_region_2’ layer. Then at bottom of the window tool, you can specify a place where the output will be saved. If you want to view the result before you save it, leave it as temporary file. For the tutorial we will name the file ‘IDW_QGIS’ Finally click Run button to start the interpolation. When finished the result will be added to your QGIS map canvas. See image below for inputs.
   
  +
[[File:IDWs.png|500px|center]]
== Acquiring QGIS (v.2.2) for this Tutorial ==
 
   
  +
=== Customize the Symbology ===
The slightly older version of QGIS that will be used for the purpose of this tutorial is v.2.2 which can be downloaded from this link [http://qgis.org/downloads/qgis-2.2.0.tar.bz2 link].
 
  +
The IDW interpolation tool will then output a black and white interpolated raster surface onto the map area. Drag the grid layer bellow the point shapefile layer. To make it more beautiful customize the symbology. To do it, right click the output result and select Properties (Or simply you can double click the layer name). The Layer Properties window will appear. Select Symbology. In the Band Rendering option change the Render type to Singleband pseudocolor. Right away the output value will be classified into some classes with different colour. You can change the number of classes or change the colour, just explore if you want.
Once you have downloaded the software from the QGIS website, follow the step-by-step installation instructions on your computer.
 
With QGIS v.2.2 now installed on your computer and a suitable point dataset to be interpolated saved on your hard drive, you are now ready to start the tutorial!
 
   
  +
After modifying the colour ramp values to reflect the range of values in a suitable way click ‘apply’ and ‘ok’ and you will now have coloured map of the IDW interpolation surface for arsenic concentration in parts per billion (ppb) in filtered, acidified water in British Columbia with a matching legend. Figure 7 is an example of inputs used. The values were classified initially using the mode ‘quantile’ then reclassified to spread out the larger concentrations of arsenic (since there are very few areas with larger quantity of arsenic). The colour ramp used is Viridis.
==Tutorial==
 
  +
The last step of this mapping process is to create a polygon of the BC boundary which will be used as a mask to clip the interpolation surface.
  +
  +
Additionally, feel free to play with the symbology of the RGS_data points to make them visible from the new coloured IDW layer using the same symbology tab or add labels.
   
  +
[[File:Sym.png|500px|center]]
===Loading Shapefiles and CSV File Data===
 
   
  +
=== Clipping Interpolation Surface to Create a New Raster Layer ===
* Launch QGIS (version 2.2) once you have installed it on your computer, and downloaded a suitable dataset to work with. There are two simple ways to import the point data into QGIS, depending on the type of data that you downloaded (shapefile, CSV file, excel spreadsheet). If your data is in the form of an excel spreadsheet (where the points have associated latitudes, longitudes and attribute data), save it as a [http://en.wikipedia.org/wiki/Comma-separated_values comma-separated value] (CSV) file before trying to import it into QGIS.
 
  +
This portion of the tutorial will provide instructions on how to create a clipping mask for the interpolation raster surface. So that the interpolation does not extend onto different areas which are not the province of BC. Please note that since this is not a tutorial on a specific area the land concentrations may have very different Arsenic concentrations compared to water.
   
* To import a shapefile, click on the ‘Layer’ tab in the upper left hand corner of the screen, and select the ‘Add Vector Data’ tab.
+
#At the top of the application there is a raster tab. Go to the dropdown ‘Extraction’ tab and select the “Clip Raster by Mask Layer”.
  +
#At the top of the window select your interpolated layer as the “input layer”, the IDW_QGIS layer. The mask will be the shape of BC’s boundary so choose the boundary file, geo_political_region_2 as your “mask layer”.
  +
#Ensure that both layers are using the same projection and then click run.
  +
#You will notice that the reclassified grid is now clipped, but the default original greyscale colouring has returned.[[File:Symbsav.png|frame|‘Export Colour Map File’ is in red, ‘Load Colour Map from File' in blue]] There is a quick way to re-symbolize the clipped raster with the appropriate colour ramp.
  +
#Right-click on the ‘reclassified grid’, the IDW_QGIS layer which still has its intact colour ramp and open the properties menu. Click on the ‘export colour map file’ button and save the text file to hard drive. Then re-open the properties menu for the ‘Clipped(mask)’ raster, select the ‘symbology’ tab, and then pick ‘Singleband Pseudocolor for the ‘render type’. Then click on the ‘load colour map from file button’ (to the left of the ‘export colour map to file’ button) and open the saved text file from the earlier step. You will now notice that your legend is back to the original format.
  +
#You will notice that these layers are only temporary and if you close the application the created layers would not save. To combat this, we need to export the layer as its GeoTIFF file so that we can save the data for later.
  +
#Right-click on the layer and click export “save feature as”.
  +
#Make sure the format is GeoTIFF and click the 3 dots next to the file name. in the folder you created earlier give this layer a name such as final_RGS_IDW. Save the project if you have not done so already.
   
  +
=== Exporting the Final Maps ===
[[File:Image1.png|200px|thumb|left]]
 
  +
Now we will make a print layout of the map and save it as an image.
  +
#Under the ‘Project’ tab, select “New Print layout”.
  +
#Assign a ‘print layout title’ that will be used for the new print layout (For example: ‘Ex1 Map’).
  +
#Under the ‘Layout’ tab, you can add a number of map elements to the print layout including the actual map, a legend, scale bars, etc., depending on the nature and purpose of the final map.
  +
#For this tutorial, experiment by adding the IDW interpolation map, map title (under ‘add label’), a legend and scale bar. A few tips: Make sure you zoom to the layer extent of the spline interpolation map first before adding it as a map to the print composer, text editing for the ‘label’ is done in a text editing box on the right-hand side of the print composer window. There is a wide variety of graphics editing tools within this print composer, so feel free to explore and play with them before exporting the final map.
   
  +
An example final output map is shown below.
   
  +
[[File:ASmap.png|thumb|none]]
   
  +
The last step of this tutorial will be exporting the map.
  +
  +
#There are a number of formats available to export the final map as, which including: PNG file, PDF or as an SVG file. For the purpose of this tutorial, we will export the map as an Image (PNG) file. To export the map, click on the ‘layout’ tab and select the ‘Export as Image’ tab.
  +
#Assign a file name to the exported file and click save.
   
  +
That concludes this tutorial.
   
  +
== Example 2 Meteorological Data ==
  +
=== Data ===
   
  +
Data can be downloaded from the [https://climate.weather.gc.ca/prods_servs/cdn_climate_summary_e.html Government of Canada’s Monthly Climate Summaries] which has values of various climatic parameters, including monthly averages and extremes of temperature, precipitation amounts, degree days, and sunshine hours.
   
  +
Follow the steps on the site to download data from a specific date, province/territory, and data format.
   
  +
#For the purpose of this tutorial we will download the data from August 2022 for all of Canada.
  +
#Download the CSV. If you want to choose from the variables they give download the legend in a txt format as well.
  +
#Save the file to a project file in your drive.
  +
[[File:Climate.png|500px|center]]
  +
*We will be using the same extent boundaries from [https://open.canada.ca/data/en/dataset/306e5004-534b-4110-9feb-58e3a5c3fd97 Administrative Boundaries in Canada] as we had in the previous section.
   
  +
=== Editing the Data===
  +
The climate data has very large amounts of variables. As such we need to edit it to make it easier to work with like we had done in the previous example.
   
  +
#Delete the variables that are unneeded.
  +
[[File:Exedit2.png]]
  +
*The location data, identifiers and mean temperature data was kept (see figure x), cells without data were also deleted.
   
  +
=== Loading CSV File Data===
  +
#Open QGIS and create a New Empty Project.
  +
#Add the boundary layer.
  +
#We need to clean up the boundary file to use the data. Go to the Layer tab, add vector layer then upload the 15m Canada boundary file named ‘geo_political_region_2’ shapefile. Open the attribute table, toggle the edit mode then delete any cells that are ‘Not Identified’ and that are ‘Outside of Canada’ in the ‘bodt’ variables.
  +
#Follow the steps from the previous example to add the csv data for the climate data. I had renamed the created vector layer into ‘Climate_Canada_082022’. Export then save feature as shapefile. I renamed the points as ‘CC2022’.
  +
#Right click the new ‘Climate_Canada_082022’ layer.
  +
#The projection of the map was also changed to ‘Canada_Albers_Equal_Area_Conic’ at this point as well. See the previous section on [https://dges.carleton.ca/CUOSGwiki/index.php/Creating_IDW_and_Spline_Interpolation_Maps_Using_QGIS#Specifying_a_Project_Projection Specifying a Project Projection].
  +
#Save the project. The result should look like the image below.
  +
[[File:CSVex2.png|center|1000px]]
   
  +
=== Run the IDW Tool ===
  +
#Click on the ‘Processing’ tab and select ‘Toolbox’ or Ctrl+Alt+T. Search IDW. For this tutorial we will use the protectory software provided by QGIS.
  +
#Click on the IDW interpolation tool from QGIS.
  +
#The IDW input window will then appear, which allows you to input the data layer being interpolated and customize the interpolation based on your needs. For the ‘Vector layer’ input use the ‘Weather Station’ vector layer, previously the ‘CC2022’ shapefile layer.
  +
#Next, specify the Interpolation attribute, which is the field value to be interpolated, ‘TM’, the Temperature means of August 2022. Click on the ‘+’ sign to add the attribute.
  +
#This time we will change the distance coefficient P to 4 to account for more sparse northern areas in this dataset.
  +
#The Extent will be the Canadian boundary, choose the ‘calculate from layer’ dropdown, then choose the ‘geo_political_region_2’ layer. Then at bottom of the window tool, you can specify a place where the output will be saved. If you want to view the result before you save it, leave it as temporary file. For this example, leave it as a temporary file. <br /> [[File:IDW2.png|center|500px]]
  +
#Finally click Run button to start the interpolation. When done the result will be added to your QGIS map canvas (See figure 5 for an example inputs).
  +
#You can save the new raster file for later use by right clicking on the new IDW layer, hover over the export dropdown menu, and saving the feature as a geoTIFF file.
   
  +
=== Clipping the Raster Layer and Changing the Symbology ===
  +
Create a clipping mask for the interpolation raster surface.
  +
#At the top of the application there is a raster tab. Go to the dropdown ‘Extraction’ tab and select the “Clip Raster by Mask Layer”.
  +
#At the top of the window select your interpolated layer as the “input layer”, the Mean Temperature raster layer we had created in the previous step. The mask will be the shape of the Canadian boundary so choose the boundary file, geo_political_region_2 as your “mask layer”.
  +
#Ensure that both layers are using the same projection and then click run.
  +
#You will notice that the reclassified grid is now clipped.
  +
#To change the symbology, right-click on the new clipped raster layer, open the properties menu for, select the ‘symbology’ tab, and then pick ‘Singleband Pseudocolor for the ‘render type’. Choose the way in which you would like to classify the data, for this data the continuous mode was used. The colour ramp used is called turbo.
  +
#You will notice that these layers are only temporary and if you were to close the application the created layers would not save to combat this, we need to export the layer as its GeoTIFF file so that we can save the data for later.
  +
#Right-click on the layer and click export “save feature as”.
  +
#Make sure the format is GeoTIFF and click the 3 dots next to the file name. In the folder you created earlier give this layer a name such as Mean_Temperature.
  +
#(optional) Add baselayer of choice from the HCMGIS plug-in as you had done in the previous example.
  +
#Save the project if you have not done so already. For an example of the symbology inputs thus far see the image below.
  +
[[File:Sym2.png|center|600px]]
   
  +
=== Create a Print Layout ===
  +
#Create a print layout using Ctrl+P.
  +
#Use the ‘Add Item’ tab to add a map, scale bar, north arrow, and title.
  +
#Play around with it stylistically.
  +
#The end result will look like the photo below.
  +
[[File:EX2map.png|thumb|none]]
   
  +
== Creating a Spline Interpolation ==
  +
The next interpolated raster surface that will be created in this tutorial is a [https://en.wikipedia.org/wiki/Thin_plate_spline thin plate spline] interpolation surface, using the ‘Weather Stations’ point dataset as the input.
   
  +
#Use the same map window as the IDW interpolation, just turn off the ‘Mean_Temperature’ raster layer so that just the data points are visible again. In the processing toolbox search for ‘Thin Plate Spline’ which will result in one SAGA spline tool with that title. Open the SAGA ‘Thin plate spline (TIN)’ tool. <br /> [[File:Tool.png]]
  +
#Use the ‘Weather Stations’ for the input data points. Again, use Tm for the input attribute. Use the value of 0.000100 for the ‘Regularization’ input. Change the ‘Neighbourhood’ to ‘[1] level 1’. The remainder of the inputs were left with their default value, except cell-size which was changed to 1.0. Run the tool. Change the values if needed. <br /> [[File:Spline.png|center|500px]]
  +
#Rename the output grid layer from ‘Target Grid’ to ‘SplineTM’. It should look like the image to the right. [[File:Spline2.png|200px|thumb|right|The initial spline interpolation will look similar to this]]
  +
#Next, we will clip the ‘SplineTM’ raster with the Canadian boundary shapefile, using the same technique that was used for the [https://dges.carleton.ca/CUOSGwiki/index.php/Creating_IDW_and_Spline_Interpolation_Maps_Using_QGIS#Clipping_Interpolation_Surface_to_Create_a_New_Raster_Layer IDW interpolation surface raster Clipping tutorial]. Use the ‘SplineTM’ as the input and specify an output filename of ‘SplineClip’. Now that the spline interpolation surface has been clipped, the last step is to assign a colour ramp to it.
  +
#The next step will be to symbolize this output grid with the same range of Mean Temperature value used in the IDW interpolation tutorial. Right click on the layer, open the ‘Properties’ into the ‘Symbology’ tab. In the Band Rendering option change the Render type to Singleband pseudocolor. After modifying the colour ramp values to reflect the range of values in a suitable way click ‘apply’ and ‘ok’. The mode used for the spline interpolation is similar to that of the IDW Mean Temperatures layer. The mode was ‘Continuous’ and the colour ramp was ‘Turbo’.
  +
#Create a print layout, export the map, and that is all for the Spline portion of the tutorial. The resulting final spline interpolation surface should look like the image below.
   
  +
[[File:Spline3.png|center|500px]]
  +
   
   
  +
A map with the IDW and Spline Interpolations will look like:
 
  +
[[File:Finalmapidwandspline.png|thumb|none]]
 
 
 
 
 
 
 
 
 
 
* A window will then prompt you to navigate to your saved shapefile dataset on your hard drive. Afterwards click ‘open’ and you should see your point data on the main display.
 
 
[[File:Image2.png]]
 
 
 
* To import a CSV file, click on the ‘Layer’ tab in the upper left hand corner of the screen, and select the ‘Add Delimited Text Layer’ tab.
 
 
[[File:Image3.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* A window will then prompt you to navigate to your saved CSV file on your hard drive. Assign a layer name for the output point data, for this tutorial ‘FrameLake_Dataset’ was assigned. Select the ‘longitude’ field to represent the x-values and the ‘latitude’ field to represent the y-values. You may be also prompted to provide a map projection for the data (sometimes this is done automatically). If so, select a [http://en.wikipedia.org/wiki/Geographic_coordinate_system geographic coordinate system ] such as [https://confluence.qps.nl/pages/viewpage.action?pageId=29855173 WGS-84] or [http://en.wikipedia.org/wiki/North_American_Datum#North_American_Datum_of_1983 NAD-83]. Then click ‘ok’ to load the xy point data.
 
 
[[File:Image4.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The next step when loading a CSV file is exporting the loaded point data (from the previous step) to a shapefile. To do this in QGIS, right-click on the loaded point data layer and click the ‘Save As’ tab.
 
 
[[File:Image5.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* A window will then prompt you to pick the format of the file being saved, choose ‘ESRI Shapefile’. Browse for a location to save the shapefile on your hard drive and assign the filename 'FrameLake_Data' for the output shapefile. You will also need to specify a [http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system UTM] [http://help.arcgis.com/en/geodatabase/10.0/sdk/arcsde/concepts/geometry/coordref/coordsys/projected/projected.htm projected coordinate system] for the output shapefile, in order to run interpolations on it in later steps. For North American datasets, one can use the NAD83 UTM projections, just be sure to select the correct UTM zone for the map area of your dataset. For the Yellowknife dataset used in this tutorial, '''NAD83 UTM zone 11''' was chosen for the projection (you can browse for NAD83(NSRS2007) / UTM zone 11N using the CRS 'Browse' button). And lastly, check the ‘Add saved file to map’ box. Then click ‘ok’.
 
 
[[File:Image6.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
===Adding Basemaps and Labeling Data Points===
 
 
* Once you have successfully loaded your shapefile data, there are a few steps to perform in order to help you visualize your dataset, which includes loading a base map (going to be used to create a clipping layer in future steps) and labeling your sample points with attribute data (concentrations of harmful elements in this tutorial).
 
 
* To load a satellite image basemap in QGIS, you need to install a plugin to do this task. Click on the ‘Plugins’ tab and select ‘Manage and Install Plugins’.
 
 
 
[[File:Image7.png]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* A window will then appear that shows what plugins have already been installed, and what plugins are available for download. (Note. Plugins are the open source equivalent of tools within the [http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//003q0000001m000000.htm Arc Toolbox] in ESRI ArcMap). In the ‘Search’ bar, type ‘OpenLayers’ and then select the ‘OpenLayers Plugin’ from the list of available plugins. Then click ‘Install Plugin’.
 
 
[[File:Image8.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* After the plugin has installed, close the plugin installation window. Then click on the 'Plugins' tab again, hover over the 'OpenLayers' Plugin, and select ‘Add Bing Aerial Layer’.
 
 
[[File:Image9.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The basemap will then appear on your map area. Drag the ‘Bing Aerial’ layer to the bottom of the map layer in the ‘Layers’ window. Then right-click on the ‘FrameLake_Data’ shapefile and select ‘Zoom to layer extent’. You will now notice that the lake water sample stations are now distributed around the areal extent of Frame Lake on the Bing Aerial layer.
 
 
[[File:Image10.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The next step will be to label the data points with the arsenic concentration measurement at each station. To do this, right-click on the FrameLake_Data shapefile and select ‘Properties’.
 
 
[[File:Image11.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The properties window will then appear. Click on the ‘Labels’ tab, check the ‘Label this layer with’ check-box and then select ‘AsPPM’ from the drop-down box of attribute data. In this window you can specify the font, style, size, color, etc. of the labels. I changed the font colour to white in this tutorial to contrast the lake colour, and then clicked ‘apply’ and ‘ok’.
 
 
[[File:Image12.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Now the As concentrations are displayed for each point on the map and the points can be viewed in relation to a basemap. Having this information available will be helpful for the next portion of the tutorial which deals with performing the interpolations.
 
 
[[File:Image13.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
===Creating the IDW Interpolated Raster Surfaces===
 
 
* The first interpolation method that will be investigated in this tutorial is the [http://en.wikipedia.org/wiki/Inverse_distance_weighting IDW] interpolation. Click on the ‘Processing’ tab and select ‘Toolbox’.
 
 
[[File:Image14.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
* The ‘Processing Toolbox’ panel will then appear on the right side of the map view. You will notice that QGIS draws tools from 8 different GIS sources (GDAL/OGR, GRASS, SAGA, etc.) including its own QGIS tool selection. The easiest way to find an appropriate IDW interpolation tool is to type ‘inverse distance’ into the upper search column. You will notice two IDW tools to choose from, one by GRASS GIS and the other by SAGA GIS. Having looked at both, I would recommend using the SAGA IDW tool, as it is more user friendly. Double click on the SAGA ‘Inverse distance weighted’ tool.
 
 
[[File:Image15.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
* The SAGA IDW inputs window will then appear, which allows you to input the data layer being interpolated and customize the interpolation based on your needs. For the ‘Points’ input use the ‘FrameLake_Data’ shapefile layer. For the ‘Attribute’, select AsPPM from the drop-down selection. Use the default values for ‘Target Grid’, ‘Distance Weighting’, ‘Inverse Distance Power’ and ‘Exponential and Gaussian Weighting Bandwidth’, as they are appropriate for the data distribution in this study. For more information on these parameters, consult the following [http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00310000002m000000 help page]. For the ‘Search Range’, use the ‘search radius (local)’ option. For the ‘Search Radius’, I assigned a radius of 500 m, which ensured that every point in the dataset had at least 1 neighboring point to compare to (feel free to assign larger and smaller values to compare the effect on the output raster). ‘All directions’ was selected for the ‘Search Mode’ because the data is fairly irregularly dispersed on the map. The default value of 10 was used for the ‘Maximum number of points’ input due to the low number of points. A ‘cell size’ of 1m was selected to produce a high resolution output raster layer. And lastly, assign a location to save the output raster ‘Grid’ (I called mine IDW_500m), and check the ‘open output file after running algorithm’ check-box. Click ‘Run’.
 
 
[[File:Image16.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The IDW interpolation tool will then output a black and white interpolated raster surface onto the map area. Drag the grid layer bellow the point shapefile layer and rename it from ‘Grid’ to ‘IDW_500m’ by right-clicking on the raster grid and selecting ‘rename’. The next step will be to reclassify the IDW_500m interpolation into 6 fields, each with a given range of values determined by the user. Unfortunately, this basic task cannot be done using the QGIS raster properties, so it will have to be done using a separate tool.
 
 
[[File:Image17.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* In the processing toolbox window, search for the SAGA tool called ‘Reclassify grid values’, and then double click on it from the selection of tools.
 
 
[[File:Image18.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* In the ‘reclassifying grid values’ window, select the IDW_500m grid raster. For the ‘Method’ option, select ‘simple table’ as this method allows you to input a range of values for a given field. For the ‘Lookup Table’ click on the button to the right of “Fixed Table 3x3’.
 
 
[[File:Image19.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The As concentration data for the 25 points were classified into 6 fields using a [http://en.wikipedia.org/wiki/Jenks_natural_breaks_optimization Jenks Natural Breaks Optimization] method in another program prior to starting this tutorial (out of the scope of this tutorial). If you are using data which is different from the data used in this tutorial, you will need to decide on how best to classify your data in terms of data ranges. In the Fixed Table window, you have the option of adding or removing as many rows as you like. For this tutorial we are going to assign 6 rows with the following values (see image) for the minimum, maximum and new values. Then click ok.
 
 
[[File:Image20.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
* Keep the remainder of the inputs in the ‘Reclassify grid values’ window at their default settings, and assign a filename of ‘IDW_500m_Reclass’ for the output ‘reclassified grid’. Also make sure to check the box which opens the output file after running the algorithm. Then click run. The new reclassified grid will then appear in the map window as a greyscale raster surface.
 
 
[[File:Image21.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* The next step is to assign a colour ramp to this reclassified raster layer. To do this, right-click on the ‘reclassified grid’ and select ‘properties’. Select the ‘Style’ tab, and then pick ‘Singleband pseudocolor’ in the ‘render type’ drop-down box. Then in the ‘Generate new color map’ area, choose the ‘spectral’ colour ramp, check the ‘invert’ check-box, select the ‘Equal Interval’ mode and 6 classes. Assign a min value of 140 and max value of 1340 and then click the ‘classify’ button. This will create a 6 class colour ramp (left hand box in the image) which needs to be reclassified based on the values of the ‘reclassified grid’.
 
 
[[File:Image22.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Double click on the numbers in the ‘value’ column, and replace them with the assigned values of the reclassified grid, as shown in the following image. Also update the ‘label’ field with the appropriate concentration ranges (as this is not done automatically).
 
 
[[File:Image23.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* After modifying the colour ramp values to reflect the correct range of values from the reclassified grid, click ‘apply’ and ‘ok’ and you will now have coloured map of the IDW_500m interpolation surface for As concentrations in Frame Lake with a matching legend. The last step of this mapping process is to create a polygon of the lake which will be used as a mask to clip the interpolation surface.
 
 
[[File:Image24.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
===Creating Clipping Polygon and Clipping Interpolation Surface===
 
 
* This portion of the tutorial will provide instructions on how to create a clipping mask for the interpolation raster surface. The idea is to digitize a polygon of the lake boundary and then clip the interpolated surfaces with it, so that the interpolation does not extend onto land (which may have very different As concentrations compared to water). In order to do so, a new shapefile needs to be created. Under the ‘Layer’ tab, click on ‘New’ and then select ‘New Shapefile Layer’.
 
 
[[File:Image25.png]]
 
 
 
* In the ‘New Vector Layer’ window, select the option to create a ‘polygon’ in the ‘type’ field. Then specify the correct projection for the shapefile (for the purpose of this tutorial use NAD83 / UTM zone 11N). Seeing that this shapefile is just going to be used to create a clipping mask polygon, no ‘new attributes’ need to be assigned. Click 'ok'. A window will then appear which allows you to specify a filename and location to save the new shapefile. Call is ‘Clip_Polygon’, and save it.
 
 
[[File:Image26.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* You will now notice your new polygon shapefile in the list of layers. The next step will be digitizing a polygon of Frame Lake. Right-click on the ‘Clip_Polygon’ layer and select the ‘Toggle editing’ button.
 
 
[[File:Image27.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Then click the ‘Add Feature’ button to start creating the polygon.
 
 
[[File:Image28.png]]
 
 
 
* Start digitizing the polygon by clicking on the edge of the lake and following the shoreline all around the lake. Use as many digitizing points as possible to ensure an accurate polygon.
 
 
[[File:Image29.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Once you have finished digitizing your polygon, right click on the last point. A window will appear that will allow you to specify an id for the polygon, assign it a value of ‘1’. Then click 'ok'. Now that we have our Lake polygon, we can save the edits made to the shapefile and close the editor. Click on the ‘current edits’ button and select the ‘save for all layers’ button. Then right-click on the Clip_Polygon shapefile layer and click on the ‘Toggle editing’ button to stop editing the polygon.
 
 
[[File:Image30.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Now we are ready to clip the ‘Reclassified grid’ using the ‘Clipping_Polygon’. To do so, search for the SAGA tool ‘Clip grid with polygon’ in the processing toolbox, and open it. In the ‘clip grid with polygon’ tool window, assign the ‘Reclassified Grid’ as the input raster layer and the ‘Clip_Polygon’ as the input polygon. Specify an output filename ‘IDW_500m_Clipped’ and click run.
 
 
[[File:Image31.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* You will notice that the reclassified grid is now clipped, but the default original greyscale colouring has returned. There is a quick way to re-symbolize the clipped raster with the appropriate colour ramp.
 
 
[[File:Image32.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Right-click on the ‘reclassified grid’, which still has its intact colour ramp and open the properties menu. Click on the ‘export color map file’ button, and save the text file to hard drive. Then re-open the properties menu for the ‘IDW_500m_Clipped’ raster, select the ‘style’ tab, and then pick ‘Singleband Pseudocolor for the ‘render type’. Then click on the ‘load colour map from file button’ (to the left of the ‘export color map to file’ button) and open the saved text file from the earlier step. You will now notice that your legend is back to the original format.
 
 
[[File:Image33.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* And now the map is complete and ready to be checked for accuracy. When you inspect the As concentration point values and the interpolated surface value under each point (looking at the legend), you will see that all the points fall in the correct interpolated value range area, indicating a good interpolation job. Now that the IDW interpolation map is complete, we will now repeat the process using the 'thin plate spline' interpolation tool.
 
 
[[File:Image34.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
===Creating the Spline Interpolated Raster Surfaces===
 
 
* The next interpolated raster surface that will be created in this tutorial is a [http://en.wikipedia.org/wiki/Thin_plate_spline thin plate spline] interpolation surface, using the Frame_Lake point dataset as the input. Use the same map window as the IDW interpolation, just turn off the ‘IDW_500m_clipped’ raster layer so that just the data points are visible again. In the processing toolbox search for ‘Thin Plate Spline (local)’ which will result in one SAGA spline tool with that title. Open the SAGA ‘Thin plate spline (local)’ tool.
 
 
[[File:Image35.png]]
 
 
 
* Use the ‘FrameLake_Data’ for the input data points. Again, use AsPPM for the input attribute. Use the default value of 0.000100 for the ‘Regularization’ input. For the search radius, more sample locations needs to be used for this thin plate spline interpolation compared to the previously done IDW interpolation, in order to obtain smoother interpolated boundaries. Therefore, a search radius of 1200m was assigned for this tutorial. The remainder of the inputs were left with their default value, except cell-size which was changed to 1.0. For more information about how splines work, visit the following [http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000078000000 website]. Assign an output filename of Spline_1200m and run the tool.
 
 
[[File:Image36.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Rename the output grid layer from ‘Grid’ to ‘Spline_1200m’. The next step will be to reclassify this output grid with the same range of As concentration value used in the IDW interpolation tutorial. Open the ‘Reclassify grid values’ tool and follow the instructions from the IDW tutorial to reclassify the raster grid [[Reclassifying tutorial]]. For the output filename, use Spline_1200m_Reclass. Then click run and you should get the following output raster image :
 
 
[[File:Image37.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* Next we will clip the ‘Spline_1200m_Reclass’ raster with the lake outline shapefile, using the same technique that was used for the IDW interpolation surface raster [[Clipping tutorial]]. Use the ‘Spline_1200m_Reclass’ as the input, and specify an output filename of ‘Spline_1200m_Clip’. Now that the spline interpolation surface has been clipped, the last step is to assign a colour ramp to it. Use the same procedure and range values that were used for the IDW interpolation tutorial.
 
 
[[File:Image38.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* And that is all for the Spline portion of the tutorial. The resulting final spline interpolation surface should look like this:
 
 
[[File:Image39.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
===Exporting the Final Maps===
 
 
* Under the ‘Project’ tab, select “New Print Composer’.
 
 
[[File:Image41.png]]
 
 
 
* Assign a ‘print composer tittle’ that will be used for the new print composer (For example: ‘Spline Map’). Under the ‘Layout’ tab, you can add a number of map elements to the print composer including the actual map, a legend, scale bars, etc., depending on the nature and purpose of the final map. For this tutorial, experiment by adding the spline interpolation map, map title (under ‘add label’), a legend and scale bar. A few tips: Make sure you zoom to the layer extent of the spline interpolation map first before adding it as a map to the print composer, text editing for the ‘label’ is done in a text editing box on the right hand side of the print composer window. There is a wide variety of graphic editing tools within this print composer, so feel free to explore and play with them before exporting the final map.
 
 
 
[[File:Image40.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* An example final output map is shown below. The last step of this tutorial will be exporting the map.
 
 
[[File:Image43.png|200px|thumb|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
* There are a number of formats available to export the final map as, which including: image file, PDF or as an SVG file. For the purpose of this tutorial, we will export the map as an SVG file, so that it can be loaded into an open source graphics editor such as Inkscape (hyperlink) for final touch-ups if needed. To export the map, click on the ‘composer’ tab and select the ‘Export as SVG’ tab.
 
 
[[File:Image44.png]]
 
 
 
 
* Assign a file name to the exported SVG file, and click save. And that concludes this tutorial.
 
   
 
=Conclusion=
 
=Conclusion=
   
In conclusion, this tutorial showed the user how to import point data into QGIS, run interpolations on the point data, clip and symbolize the data and export the interpolated data as a finished map. I hope this tutorial provided adequate instructions on how to download the software and data, and to perform the various tasks needed to create an IDW and Thin Plate Spline interpolation surface. Unfortunately, I did not have the time to create a tutorial on kriging using an open source GIS program, but this is certainly still something I would like to do in the future. Please feel free to comment on anything in this tutorial that is poorly explained or does not make any sense.
+
In conclusion, this tutorial aimed to show the user how to import point data into QGIS, run interpolations on the point data, clip and symbolize the data and export the interpolated data as a finished map. I hope this tutorial provided adequate instructions on how to download the software and data, edit data, and to perform the various tasks needed to create '''''IDW''''' and '''''thin plate spline''''' interpolation maps. Perhaps in the future a kriging tutorial could be added to this interpolation tutorial.
   
 
=Resources=
 
=Resources=
  +
*ArcGIS Pro 3.0. (n.d.-a). How inverse distance weighted interpolation works. ArcGIS Pro. Retrieved October 5, 2022, from https://pro.arcgis.com/en/pro-app/latest/help/analysis/geostatistical-analyst/how-inverse-distance-weighted-interpolation-works.htm
 
* ArcGIS Resources (August 11, 2012). ArcGIS Help 10.1:Understanding interpolation analysis. http://resources.arcgis.com/en/help/main/10.1/index.html#//009z0000006w000000
+
*ArcGIS Pro 3.0. (n.d.-b). IDW (3D Analyst). ArcGIS Pro. Retrieved October 5, 2022, from https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/idw.htm
  +
*ArcGIS Pro 3.0. (n.d.-c). Spline (3D Analyst). ArcGIS Pro. Retrieved October 5, 2022, from https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/spline.htm
 
  +
*BC Environment Standard Projection. (n.d.). Retrieved October 5, 2022, from https://ibis.geog.ubc.ca/~brian/Course.Notes/bceprojection.html
* ArcGIS Resources (August 11, 2012). ArcGIS Help 10.1:How IDW works. Retrieved on December 14, 2014 from http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000075000000
 
  +
*Environment and Climate Change Canada. (2022, August 17). Monthly Climate Summaries - Climate. Environment and Climate Change Canada. https://climate.weather.gc.ca/prods_servs/cdn_climate_summary_e.html
 
  +
*Han, T., & Rukhlov, A. S. (2020). Update of the provincial Regional Geochemical Survey (RGS) database at the British Columbia Geological Survey. British Columbia Ministry of Energy, Mines and Petroleum Resources, British Columbia Geological Survey GeoFile. https://www2.gov.bc.ca/gov/content/industry/mineral-exploration-mining/british-columbia-geological-survey/geology/regional-geochemical-survey
* ArcGIS Resources (August 11, 2012). ArcGIS Help 10.1:How spline works. Retrieved on December 14, 2014 from http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000078000000
 
  +
*Homepage - OSGeo. (n.d.). OSGeo. Retrieved October 5, 2022, from https://www.osgeo.org/
 
  +
*Jones, L., & Rukhlov, A. (2020, December 10). Regional Geochemical Survey Data - Open Government Portal. Government of British Columbia. https://open.canada.ca/data/en/dataset/49a73c36-4a25-4be5-b6d1-abd020fb031a
* GeoBase (December 08, 2014). Geobase database homepage. Retrieved on December 14, 2014 from http://www.geobase.ca/geobase/en/
 
  +
*Natural Resources Canada. (2022, February 1). Administrative Boundaries in Canada - CanVec Series - Administrative Features. Government of Canada; Natural Resources Canada; Strategic Policy and Innovation Sector. https://open.canada.ca/data/en/dataset/306e5004-534b-4110-9feb-58e3a5c3fd97
 
* GeoGratis (2014). Natural Resources Canada: GeoGratis database homepage. Retrieved on December 14, 2014 from http://www.geogratis.gc.ca/geogratis/Home?lang=en
+
*OSGeo. (n.d.). Choose a project - OSGeo. OSGeo. Retrieved October 5, 2022, from https://www.osgeo.org/choose-a-project/
  +
*QGIS. (n.d.). Welcome to the QGIS project! Retrieved October 5, 2022, from https://www.qgis.org/en/site/
 
  +
*Wikipedia contributors. (2022a, June 16). Universal Transverse Mercator coordinate system. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system
* GIS Data Depot (2014). Geo-Community: The GIS Data Depot. Retrieved on December 14, 2014 from http://data.geocomm.com/
 
  +
*Wikipedia contributors. (2022b, June 24). Interpolation. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Interpolation
 
  +
*Wikipedia contributors. (2022c, August 16). QGIS. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/w/index.php?title=QGIS&oldid=1104710526
* Free GIS Datasets (December 11, 2014). Free GIS Datasets homepage. Retrieved on December 14, 2014 from http://freegisdata.rtwilson.com/
 
  +
*Wikipedia contributors. (2022d, August 27). North American Datum. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/North_American_Datum#North_American_Datum_of_1983
 
  +
*Wikipedia contributors. (2022e, August 30). Comma-separated values. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Comma-separated_values
* QGIS. (2014). QGIS: A free and Open Source Geographic Information System. Retrieved December 14, 2014 from http://www.qgis.org/en/site/index.html
 
  +
*Wikipedia contributors. (2022f, September 15). Geographic Information System. Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/w/index.php?title=Geographic_information_system&oldid=1110491855
 
  +
*Wikipedia contributors. (2022g, September 22). Projected coordinate system. Wikipedia Contributors . https://en.wikipedia.org/wiki/Projected_coordinate_system
* QGIS. (2014) Download QGIS for your Platform. Retrieved on December 14, 2014 from http://www.qgis.org/en/site/forusers/download.html
 
  +
*Wikipedia contributors. (2022h, September 28). Geographic coordinate system . Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/wiki/Geographic_coordinate_system
 
* QGIS. (2014). Features of QGIS. Retrieved on December 14, 2014 from http://www.qgis.org/en/site/about/features.html
+
*World Geodetic System 1984 (WGS84). (n.d.). Qinsy. Retrieved October 5, 2022, from https://confluence.qps.nl/qinsy/latest/en/world-geodetic-system-1984-wgs84-29855173.html

Latest revision as of 21:14, 6 October 2022


Learning Outcomes of this Tutorial

By the end of this tutorial, you will be able to perform the following tasks within 'Quantum' GIS (QGIS):

  • Importing point data files (shapefile, CSV)
  • Importing satellite imagery basemaps
  • Labelling point data using attribute information
  • Creating interpolated raster surfaces using (IDW Inverse Distance Weight) and spline interpolation methods
  • Symbolizing the interpolated raster surfaces
  • Clipping raster surfaces with digitized polygons
  • Exporting the raster surfaces as a finished map

Purpose

The purpose of this tutorial is to introduce users to IDW and Spline interpolations, using several tools and plugins within QGIS, with the goal of creating interpolation maps.

IDW uses the measured values surrounding the prediction location to predict a value for any unsampled location, based on the assumption that things that are close to one another are more alike than those that are farther apart. For more information on IDW visit How IDW works.

Spline Interpolates a raster surface from points using a two-dimensional minimum curvature spline technique. The resulting smooth surface passes exactly through the input points.

IDW and Spline interpolations are similar in that they are methods that create surfaces based on similarity of the data or the degree of smoothness. However, spline differs from IDW in that it passes through each sample point. IDW does not pass through any points.

Introduction

QGIS is a free and open source geographic information system (GIS) that is developed and supported by thousands of users and organizations around the world. It's core features include a suite of vector and raster tools that are compatible with many of the most popular geospatial file formats.

This tutorial was completed as a partial requirement of the GEOM-4008 GIS course at Carleton University as the final course project. For a complete list of other tutorials created for this course by students in the past, visit the CUOSG page.

This tutorial incorporates step-by-step instructions and screenshots for each procedure which should be easy to follow along at any skill level.

Open Source

The term ‘open source’ refers to accessible, free and redistributable programs available to the public. Compared to more common commercial packages such as ArcGIS, which have costly license subscriptions, open source programs like QGIS are free of charge to use. Additionally, open source programs and data allows individuals to work together to code. This type of model encourages open collaboration. If you would like, feel free to look at available open source technology at OSGeo.

About QGIS

QGISlogo.png

As described on their website, QGIS is a "A Free and Open Source Geographic Information System", and the latest version of the software (v3.26 Buenos Aires as of September 2022) is available for download on their Official Website. Similar to other GIS platforms it can be used to edit, create, visually represent, analyze and export a variety of geospatial data and it is licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo). It runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster, and database formats and functionalities.

Installing QGIS

There are several versions of QGIS available for download. For the purposes of this tutorial, we will be using the long-term release version (QGIS 3.22).

  • Follow this link QGIS Download to the QGIS site.
  • Ensure that you are on the “Installation Download” tab.
    • There are three versions of the QGIS installer available in this tab. The first is a network installer which is not needed for our application, the other two are the latest release (Version 3.26) and the long-term release (Version 3.22). We will be using the long-term release because it provides the most stability and is more widely used due to it receiving minor updates less frequently.
QGISdl.png
  • The slightly older version of QGIS that will be used for the purpose of this tutorial is v.3.22, which can be downloaded by clicking this link.
  • Once you have downloaded the software from the QGIS website, follow the step-by-step installation instructions on your computer. After the QGIS v.3.22 LTR is downloaded and ready to execute, double click the QGIS shortcut icon on your Desktop or search for it in the Start Menu. The QGIS window opens, and we are ready to begin.

Example 1 IDWs of Chemical Concentrations

Data

The dataset selected for the purpose of this tutorial is publicly available from the Government of British Columbia (GoBC) from the Regional Geochemical Survey. The joint federal-provincial Regional Geochemical Surveys (RGS) have been carried out in British Columbia since 1976 as part of the National Geochemical Reconnaissance (NGR) program to aid exploration and development of mineral resources. The British Columbia Geological Survey (BCGS) maintains provincial geochemical databases capturing information from multi-media surveys. The latest release (as of September 2022) augments the database with new RGS data compiled from BCGS and Geoscience BC publications between 2016 and 2019. For more information visit the Regional Geochemical Survey Page.

This tutorial uses data provided by the GoBC. However, any point dataset can be used for the purpose of this tutorial, as long as the points have a geographic location and an attribute that can be used for the interpolation (elevation, chemical concentration, precipitation measurements, etc).

Downloading the Data

  1. Go to the Regional Geochemical Survey Data Page, scroll down to the Data and Resources section and click download to the right of the 2020 database Excel file labeled RGS2020 data. RGSdl.png
  2. It is recommended that you also download the metadata file associated with the data if you would like to know an explanation of the various headings.
  3. We will also be using a boundary shapefile to create the extent of the survey data’s raster from Administrative Boundaries in Canada, Download the Prepackaged Shapefiles then add the ‘geo_political_region_2’ files to your project folder.
    Canadabnddl.png

Editing the Data

This data has very large amounts of variables. As such we need to edit it to make it easier to work with:

  1. Open the Excel file (or other spreadsheet software- if opening a CSV file make sure that you select "separated by a comma" to format the file correctly).
  2. Beginning with the variable to include in the set, in this case we are using arsenic concentration in parts per billion (ppb) in filtered, acidified water by ICP-MS.(As_ppb). Use the metadata file to locate the chemical concentration of interest and delete all other variables not dealing with location or identification.
  3. Once you have done this save your data as a CSV file (File, export, change file type, CSV, Save As) and you are ready to bring them into QGIS.

Adding a Base Layer

  1. Launch QGIS once you have installed it on your computer and downloaded a suitable dataset to work with.
  2. At the top of your toolbar, click the plugin tab and click the "manage and install plugins" item.
  3. In the "all" tab, search for the " HCMGIS" plugin and install it to QGIS. Once this is done restart QGIS.
  4. Once you are back into a new project layer, click the HCMGIS tab at the top and go to the BaseMap dropdown and select ‘Bing Virtual Earth’.

Specifying a Project Projection

You will also need to specify a projected coordinate system for the project and shapefiles, in order to run interpolations on the data’s output shapefile in later steps. For North American datasets, one would commonly use the NAD83 UTM projections, making sure to select the correct UTM zone for the map area of your dataset. However, for the British Columbia dataset used in this tutorial, NAD83 / BC Albers was chosen for the projection, as it is a British Columbia Environment Standard Projection.

  1. Use Ctrl+Shift+P.
  2. In the CRS tab search ‘BC’.
  3. Click NAD83 / BC Albers under projected coordinate systems then click ‘OK’.
ProjectionBCAlbers.png

Loading CSV File Data and Provincial Boundary File

There are two simple ways to import the point data into QGIS, depending on the type of data that you downloaded (shapefile, CSV file, excel spreadsheet). If your data is in the form of an Excel spreadsheet (where the points have associated latitudes, longitudes and attribute data), save it as a comma-separated value (CSV) file before trying to import it into QGIS.

  1. Create a New Empty Project.
  2. To import a CSV file, click on the ‘Layer’ tab in the upper left-hand corner of the screen, and select the ‘Add Delimited Text Layer’ tab.
    CSVtoVec.png
  3. A window will then prompt you to navigate to your saved CSV file on your hard drive. It is recommended to create a space where you will be saving all your files and file layers (creating a new folder to keep everything in to keep all paths the same for the project is recommended).
  4. Assign a layer name for the output point data, for this tutorial ‘rgs2020_data’ was assigned. Select the ‘longitude’ field to represent the x-values and the ‘latitude’ field to represent the y-values. You may be also prompted to provide a map projection for the data. If so, select the appropriate geographic coordinate system for your dataset, such as WGS-84 or NAD-83. Then click ‘Add’ on the right-hand side to load the xy point data.
    CSV2.png
  5. The next step when loading a CSV file is exporting the loaded point data (from the previous step) to a shapefile. To do this in QGIS, right-click on the loaded point data layer and click export "save feature as".
    CSV3.png
  6. A window will then prompt you to pick the format of the file being saved, choose ‘ESRI Shapefile’. Browse for a location to save the shapefile on your hard drive and assign the filename RGS_data' for the output shapefile. Make sure the check box for ‘Add saved file to map’ is checked. Then click ‘OK’
  7. For the provincial boundary shapefile click on the layer tab at the top of the page go to the "add layer" tab and scroll to the "add Vector layer" tab.
  8. In the new window, click the 3 dots at the top right corner of the screen (you will be finding the boundary file we downloaded) in the package you downloaded click the file with the .shp end to it and add it to your project.
  9. Once it is loaded right-click on the layer and select "Open attribute table"
  10. Once open, click the pencil at the top left of the window to toggle editing.
  11. Then select all layers besides those labelled British Columbia and click the "delete selected feature" (red trashcan).
  12. Once this is complete you should have the RGS data layer, the British Columbia boundary layer, and the base map layer in your project layers from top to bottom. It should look like the image below.
    Sofar1.png

Creating the IDW Interpolated Raster Surfaces

Before creating the IDW layer the data should be cleaned, first, we need to select all areas with water with valid arsenic concentration levels (i.e. > 0): to do so, follow these steps:

  1. Right click on the RGS_data layer and open its Attribute table.
  2. Click on “Select features using an expression”.
  3. In the window, write the following expression: "As_ppb" > 0, and then click “Select features”.
  4. Invert Selection using Ctrl+R, edit the selection with Ctrl+E and delete the selected features.
Attrib1.png

Now that we have selected all the survey areas with arsenic concentrations greater than 0, we can proceed with the IDW interpolation.

  1. Click on the ‘Processing’ tab and select ‘Toolbox’ or Ctrl+Alt+T. Search IDW. You will notice that QGIS draws tools from different GIS sources (GDAL, GRASS, SAGA, etc.) including its own QGIS tool selection. If you use the IDW tool from GRASS or GDAL, it will provide more options including how many sampling points to be used, radius distance, cell size, etc. compared to default QGIS IDW Interpolation tool which only allows specifying the P value, and number of output rows and columns. For this tutorial we will use the protectory software provided by QGIS.
  2. Click on the IDW interpolation tool from QGIS.
  3. The IDW input window will then appear, which allows you to input the data layer being interpolated and customize the interpolation based on your needs. For the ‘Vector layer’ input use the ‘RGS_data’ shapefile layer.
  4. Next, specify the Interpolation attribute, which is the field value to be interpolated. The map we are making deals with arsenic concentration levels so chose the corresponding field, ‘As_ppb”. Click on the ‘+’ sign to add the attribute.
  5. The Extent will be the BC boundary, choose the ‘calculate from layer’ dropdown, then choose the ‘geo_political_region_2’ layer. Then at bottom of the window tool, you can specify a place where the output will be saved. If you want to view the result before you save it, leave it as temporary file. For the tutorial we will name the file ‘IDW_QGIS’ Finally click Run button to start the interpolation. When finished the result will be added to your QGIS map canvas. See image below for inputs.
IDWs.png

Customize the Symbology

The IDW interpolation tool will then output a black and white interpolated raster surface onto the map area. Drag the grid layer bellow the point shapefile layer. To make it more beautiful customize the symbology. To do it, right click the output result and select Properties (Or simply you can double click the layer name). The Layer Properties window will appear. Select Symbology. In the Band Rendering option change the Render type to Singleband pseudocolor. Right away the output value will be classified into some classes with different colour. You can change the number of classes or change the colour, just explore if you want.

After modifying the colour ramp values to reflect the range of values in a suitable way click ‘apply’ and ‘ok’ and you will now have coloured map of the IDW interpolation surface for arsenic concentration in parts per billion (ppb) in filtered, acidified water in British Columbia with a matching legend. Figure 7 is an example of inputs used. The values were classified initially using the mode ‘quantile’ then reclassified to spread out the larger concentrations of arsenic (since there are very few areas with larger quantity of arsenic). The colour ramp used is Viridis. The last step of this mapping process is to create a polygon of the BC boundary which will be used as a mask to clip the interpolation surface.

Additionally, feel free to play with the symbology of the RGS_data points to make them visible from the new coloured IDW layer using the same symbology tab or add labels.

Sym.png

Clipping Interpolation Surface to Create a New Raster Layer

This portion of the tutorial will provide instructions on how to create a clipping mask for the interpolation raster surface. So that the interpolation does not extend onto different areas which are not the province of BC. Please note that since this is not a tutorial on a specific area the land concentrations may have very different Arsenic concentrations compared to water.

  1. At the top of the application there is a raster tab. Go to the dropdown ‘Extraction’ tab and select the “Clip Raster by Mask Layer”.
  2. At the top of the window select your interpolated layer as the “input layer”, the IDW_QGIS layer. The mask will be the shape of BC’s boundary so choose the boundary file, geo_political_region_2 as your “mask layer”.
  3. Ensure that both layers are using the same projection and then click run.
  4. You will notice that the reclassified grid is now clipped, but the default original greyscale colouring has returned.
    ‘Export Colour Map File’ is in red, ‘Load Colour Map from File' in blue
    There is a quick way to re-symbolize the clipped raster with the appropriate colour ramp.
  5. Right-click on the ‘reclassified grid’, the IDW_QGIS layer which still has its intact colour ramp and open the properties menu. Click on the ‘export colour map file’ button and save the text file to hard drive. Then re-open the properties menu for the ‘Clipped(mask)’ raster, select the ‘symbology’ tab, and then pick ‘Singleband Pseudocolor for the ‘render type’. Then click on the ‘load colour map from file button’ (to the left of the ‘export colour map to file’ button) and open the saved text file from the earlier step. You will now notice that your legend is back to the original format.
  6. You will notice that these layers are only temporary and if you close the application the created layers would not save. To combat this, we need to export the layer as its GeoTIFF file so that we can save the data for later.
  7. Right-click on the layer and click export “save feature as”.
  8. Make sure the format is GeoTIFF and click the 3 dots next to the file name. in the folder you created earlier give this layer a name such as final_RGS_IDW. Save the project if you have not done so already.

Exporting the Final Maps

Now we will make a print layout of the map and save it as an image.

  1. Under the ‘Project’ tab, select “New Print layout”.
  2. Assign a ‘print layout title’ that will be used for the new print layout (For example: ‘Ex1 Map’).
  3. Under the ‘Layout’ tab, you can add a number of map elements to the print layout including the actual map, a legend, scale bars, etc., depending on the nature and purpose of the final map.
  4. For this tutorial, experiment by adding the IDW interpolation map, map title (under ‘add label’), a legend and scale bar. A few tips: Make sure you zoom to the layer extent of the spline interpolation map first before adding it as a map to the print composer, text editing for the ‘label’ is done in a text editing box on the right-hand side of the print composer window. There is a wide variety of graphics editing tools within this print composer, so feel free to explore and play with them before exporting the final map.

An example final output map is shown below.

ASmap.png

The last step of this tutorial will be exporting the map.

  1. There are a number of formats available to export the final map as, which including: PNG file, PDF or as an SVG file. For the purpose of this tutorial, we will export the map as an Image (PNG) file. To export the map, click on the ‘layout’ tab and select the ‘Export as Image’ tab.
  2. Assign a file name to the exported file and click save.

That concludes this tutorial.

Example 2 Meteorological Data

Data

Data can be downloaded from the Government of Canada’s Monthly Climate Summaries which has values of various climatic parameters, including monthly averages and extremes of temperature, precipitation amounts, degree days, and sunshine hours.

Follow the steps on the site to download data from a specific date, province/territory, and data format.

  1. For the purpose of this tutorial we will download the data from August 2022 for all of Canada.
  2. Download the CSV. If you want to choose from the variables they give download the legend in a txt format as well.
  3. Save the file to a project file in your drive.
Climate.png

Editing the Data

The climate data has very large amounts of variables. As such we need to edit it to make it easier to work with like we had done in the previous example.

  1. Delete the variables that are unneeded.

Exedit2.png

  • The location data, identifiers and mean temperature data was kept (see figure x), cells without data were also deleted.

Loading CSV File Data

  1. Open QGIS and create a New Empty Project.
  2. Add the boundary layer.
  3. We need to clean up the boundary file to use the data. Go to the Layer tab, add vector layer then upload the 15m Canada boundary file named ‘geo_political_region_2’ shapefile. Open the attribute table, toggle the edit mode then delete any cells that are ‘Not Identified’ and that are ‘Outside of Canada’ in the ‘bodt’ variables.
  4. Follow the steps from the previous example to add the csv data for the climate data. I had renamed the created vector layer into ‘Climate_Canada_082022’. Export then save feature as shapefile. I renamed the points as ‘CC2022’.
  5. Right click the new ‘Climate_Canada_082022’ layer.
  6. The projection of the map was also changed to ‘Canada_Albers_Equal_Area_Conic’ at this point as well. See the previous section on Specifying a Project Projection.
  7. Save the project. The result should look like the image below.
CSVex2.png

Run the IDW Tool

  1. Click on the ‘Processing’ tab and select ‘Toolbox’ or Ctrl+Alt+T. Search IDW. For this tutorial we will use the protectory software provided by QGIS.
  2. Click on the IDW interpolation tool from QGIS.
  3. The IDW input window will then appear, which allows you to input the data layer being interpolated and customize the interpolation based on your needs. For the ‘Vector layer’ input use the ‘Weather Station’ vector layer, previously the ‘CC2022’ shapefile layer.
  4. Next, specify the Interpolation attribute, which is the field value to be interpolated, ‘TM’, the Temperature means of August 2022. Click on the ‘+’ sign to add the attribute.
  5. This time we will change the distance coefficient P to 4 to account for more sparse northern areas in this dataset.
  6. The Extent will be the Canadian boundary, choose the ‘calculate from layer’ dropdown, then choose the ‘geo_political_region_2’ layer. Then at bottom of the window tool, you can specify a place where the output will be saved. If you want to view the result before you save it, leave it as temporary file. For this example, leave it as a temporary file.
    IDW2.png
  7. Finally click Run button to start the interpolation. When done the result will be added to your QGIS map canvas (See figure 5 for an example inputs).
  8. You can save the new raster file for later use by right clicking on the new IDW layer, hover over the export dropdown menu, and saving the feature as a geoTIFF file.

Clipping the Raster Layer and Changing the Symbology

Create a clipping mask for the interpolation raster surface.

  1. At the top of the application there is a raster tab. Go to the dropdown ‘Extraction’ tab and select the “Clip Raster by Mask Layer”.
  2. At the top of the window select your interpolated layer as the “input layer”, the Mean Temperature raster layer we had created in the previous step. The mask will be the shape of the Canadian boundary so choose the boundary file, geo_political_region_2 as your “mask layer”.
  3. Ensure that both layers are using the same projection and then click run.
  4. You will notice that the reclassified grid is now clipped.
  5. To change the symbology, right-click on the new clipped raster layer, open the properties menu for, select the ‘symbology’ tab, and then pick ‘Singleband Pseudocolor for the ‘render type’. Choose the way in which you would like to classify the data, for this data the continuous mode was used. The colour ramp used is called turbo.
  6. You will notice that these layers are only temporary and if you were to close the application the created layers would not save to combat this, we need to export the layer as its GeoTIFF file so that we can save the data for later.
  7. Right-click on the layer and click export “save feature as”.
  8. Make sure the format is GeoTIFF and click the 3 dots next to the file name. In the folder you created earlier give this layer a name such as Mean_Temperature.
  9. (optional) Add baselayer of choice from the HCMGIS plug-in as you had done in the previous example.
  10. Save the project if you have not done so already. For an example of the symbology inputs thus far see the image below.
Sym2.png

Create a Print Layout

  1. Create a print layout using Ctrl+P.
  2. Use the ‘Add Item’ tab to add a map, scale bar, north arrow, and title.
  3. Play around with it stylistically.
  4. The end result will look like the photo below.
EX2map.png

Creating a Spline Interpolation

The next interpolated raster surface that will be created in this tutorial is a thin plate spline interpolation surface, using the ‘Weather Stations’ point dataset as the input.

  1. Use the same map window as the IDW interpolation, just turn off the ‘Mean_Temperature’ raster layer so that just the data points are visible again. In the processing toolbox search for ‘Thin Plate Spline’ which will result in one SAGA spline tool with that title. Open the SAGA ‘Thin plate spline (TIN)’ tool.
    Tool.png
  2. Use the ‘Weather Stations’ for the input data points. Again, use Tm for the input attribute. Use the value of 0.000100 for the ‘Regularization’ input. Change the ‘Neighbourhood’ to ‘[1] level 1’. The remainder of the inputs were left with their default value, except cell-size which was changed to 1.0. Run the tool. Change the values if needed.
    Spline.png
  3. Rename the output grid layer from ‘Target Grid’ to ‘SplineTM’. It should look like the image to the right.
    The initial spline interpolation will look similar to this
  4. Next, we will clip the ‘SplineTM’ raster with the Canadian boundary shapefile, using the same technique that was used for the IDW interpolation surface raster Clipping tutorial. Use the ‘SplineTM’ as the input and specify an output filename of ‘SplineClip’. Now that the spline interpolation surface has been clipped, the last step is to assign a colour ramp to it.
  5. The next step will be to symbolize this output grid with the same range of Mean Temperature value used in the IDW interpolation tutorial. Right click on the layer, open the ‘Properties’ into the ‘Symbology’ tab. In the Band Rendering option change the Render type to Singleband pseudocolor. After modifying the colour ramp values to reflect the range of values in a suitable way click ‘apply’ and ‘ok’. The mode used for the spline interpolation is similar to that of the IDW Mean Temperatures layer. The mode was ‘Continuous’ and the colour ramp was ‘Turbo’.
  6. Create a print layout, export the map, and that is all for the Spline portion of the tutorial. The resulting final spline interpolation surface should look like the image below.
Spline3.png


A map with the IDW and Spline Interpolations will look like:

Finalmapidwandspline.png

Conclusion

In conclusion, this tutorial aimed to show the user how to import point data into QGIS, run interpolations on the point data, clip and symbolize the data and export the interpolated data as a finished map. I hope this tutorial provided adequate instructions on how to download the software and data, edit data, and to perform the various tasks needed to create IDW and thin plate spline interpolation maps. Perhaps in the future a kriging tutorial could be added to this interpolation tutorial.

Resources