Difference between revisions of "Hydrological Analysis Using Whitebox Geospatial Analysis Tools"
m (→Acquiring and Installing Whitebox (QGIS): -- Fixing images) |
|||
| (57 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== |
==Introduction== |
||
[[File:WhiteBox.png |200px]] |
|||
The purpose of this tutorial is to guide the user through an exploration of hydrology tools through the process of analyzing the hydrology of an area. |
|||
This tutorial uses the opensource software Whitebox Geospatial Analyst Tools and explores some of the most useful of the hydrology tools included in it. |
|||
The intent of this tutorial is for the user to understand the process underwent, an to be able to build off of it for their specific hydrology needs. |
|||
This tutorial uses Whitebox tools, an open source GIS software that was developed within the Center for Hydrogeomatics in Guelph University. As a result this software package has a heavy focus on hydrological analysis. For this reason Whitebox was chosen for this tutorial on hydrological analysis. WhiteBox has recently been completely re-written from the ground up using a more advanced backend. This means that the toolset has migrated away from a stand-a-lone software. It is now accessible either through code (Python or R) or as a package using QGIS. This tutorial originally used the older version but has been updated to use the QGIS version in October 2026. |
|||
This tutorial assumes that the user has some experience with GIS software. |
|||
==Introduction== |
|||
[[File:WhiteboxVersion.png]] |
|||
This tutorial uses Whitebox 3.4.0, an open source GIS software that was developed within the Center for Hydrogeomatics in Guelph University. As a result this software package has a heavy focus on hydrological analysis. For this reason Whitebox was chosen for this tutorial on hydrological analysis. |
|||
The area of focus in this tutorial is Calabogie Ontario. This location was chosen because the Calabogie peak adds some relief to the area, and the author knew it well enough to tell if there were any errors that occurred during the analysis process. |
The area of focus in this tutorial is Calabogie Ontario. This location was chosen because the Calabogie peak adds some relief to the area, and the author knew it well enough to tell if there were any errors that occurred during the analysis process. |
||
This tutorial uses a single input, a Digital Elevation model, and produces a multitude of outputs from it, adding information that could be used for future analysis. The process that will be undergone in this tutorial is displayed in the image below. To understand the context of each tool used in this tutorial please refer back to this image as needed. |
This tutorial uses a single input, a Digital Elevation model, and produces a multitude of outputs from it, adding information that could be used for future analysis. The process that will be undergone in this tutorial is displayed in the image below. To understand the context of each tool used in this tutorial please refer back to this image as needed. |
||
[[File:Overview.PNG| |
[[File:Overview.PNG|800x400px]] |
||
==Data Acquisition== |
==Data Acquisition== |
||
| Line 23: | Line 17: | ||
A sample of this data is shown bellow. |
A sample of this data is shown bellow. |
||
[[File:DataExa.PNG| |
[[File:DataExa.PNG|600px]] |
||
For the event that the dropbox link has become inactive the process of obtaining this data is described below to make this tutorial relevant for longer. |
For the event that the dropbox link has become inactive the process of obtaining this data is described below to make this tutorial relevant for longer. |
||
| Line 37: | Line 31: | ||
The map extent on the right side of the web page should now match the image below. |
The map extent on the right side of the web page should now match the image below. |
||
[[File:MapExtent.PNG]] |
[[File:MapExtent.PNG | 600px]] |
||
| Line 44: | Line 38: | ||
Under “Select options and submit job” fill all of the required boxes so that it matches the figure below. Make sure to enter the email address that you would like to have the file sent to in the “Email Address” field. |
Under “Select options and submit job” fill all of the required boxes so that it matches the figure below. Make sure to enter the email address that you would like to have the file sent to in the “Email Address” field. |
||
[[File:SelectOptions2.png]] |
[[File:SelectOptions2.png | 300px]] |
||
An email will be sent to the entered email address shortly which contains a URL for the direct download of the data. |
An email will be sent to the entered email address shortly which contains a URL for the direct download of the data. |
||
| Line 50: | Line 44: | ||
If neither of these options are available, any DEM raster can be used. |
If neither of these options are available, any DEM raster can be used. |
||
==Acquiring and Installing Whitebox (QGIS)== |
==Acquiring and Installing Whitebox Plugin (QGIS)== |
||
Please note the previous version of Whitebox used for this tutorial is now [https://github.com/opengeos/whiteboxR/issues/138#issuecomment-4545971338 deprecated] and has transitioned to be used via coding APIs or QGIS only. This tutorial will now |
Please note the previous version of Whitebox used for this tutorial is now [https://github.com/opengeos/whiteboxR/issues/138#issuecomment-4545971338 deprecated] and has transitioned to be used via coding APIs or QGIS only. This tutorial will now use Whitebox Geospatial Analysis Tools in QGIS instead of the older version. This tutorial presumes the user has some QGIS knowledge and already has QGIS installed. For more details, please see the the [https://qgis.org/download/official QGIS download page] for more instructions. |
||
To setup your QIGS workspace for WhiteBox you will need to install the "WhiteBox Workflows for QGIS" plugin. |
To setup your QIGS workspace for WhiteBox you will need to install the "WhiteBox Workflows for QGIS" plugin. |
||
| Line 57: | Line 51: | ||
To start, find the plugin manager in QGIS by going to plugins > Manage and Install Plugins... |
To start, find the plugin manager in QGIS by going to plugins > Manage and Install Plugins... |
||
[[File:Plugin installer.png]] |
[[File:Plugin installer.png|400px]] |
||
Then search all plugins for "WhiteBox Workflows for QGIS" |
Then search all plugins for "WhiteBox Workflows for QGIS" |
||
[[File:Install Plugin Whitebox.png]] |
[[File:Install Plugin Whitebox.png|400px]] |
||
Install |
Install the plugin, once that is finished please move on to the next section. |
||
[[File:Whitebox in toolkit.png]] |
|||
==Getting Started== |
==Getting Started== |
||
===Accessing WhiteBox Tools=== |
|||
You're now all set to start using WhiteBox Tools. If you do not see them go to Processing > Toolbox to display the window. |
|||
[[File:Toolbox location.png|400px]] |
|||
===Launching Whitebox 3.4.0=== |
|||
After the file has been extracted the contents should look similar to the image below. |
|||
[[File:FileContents.PNG]] |
|||
Double click on the "WhiteboxGIS.jar" file in order to launch the program. |
|||
'''Note:''' If you are running Windows 10 on your computer you may need to double click on the "Whitebox.bat" file to launch it instead. |
|||
=== Setting up a working Directory === |
|||
For this Tutorial I created a working directory before starting any analysis processes. This step is not necessary, though it will aid in the organization of this project. |
|||
Create a folder called "WhiteboxTutorial", or something similar. |
|||
Within this folder create one folder called "Data", and another called "DataProducts". |
|||
The final product will look like the image below. |
|||
[[File:WorkingDirectory.PNG]] |
|||
Place the DEM.tif data file into the "Data" folder. |
|||
All files created from the DEM file will be placed in the "DataProducts" folder. i.e. all files output by Whitebox tools while going through this tutorial. |
|||
Also, project files will be saved directly within the "WhiteboxTutorial" folder itself. |
|||
===Adding Elevation Data and Saving the Map Project=== |
|||
To add the elevation data to the project select the icon in the top left of the Whitebox window, highlighted in red in the image below. (or use the hotkey Ctrl + L). |
|||
[[File:AddData.png]] |
|||
A popup window will then appear. |
|||
In this window navigate to the location of the Calabogie DEM data file and select open. |
|||
[[File:AddDEM.PNG]] |
|||
You will likely recive a popup message like the one below. |
|||
Select okay to add your data to the map. |
|||
[[File:ErrorMsg.PNG]] |
|||
To save your project select "Save Map" under the "Cartography" tab. (or use the hotkey Ctrl + S). |
|||
[[File:SaveMap.png]] |
|||
You will find the whitebox tools displayed at the bottom of the list. These tools will be used for the rest of the tutorial so please make sure you have access to them as shown here. |
|||
In the pop up window that appears navigate to the location that you would like to save the project and select "Save". |
|||
[[File: |
[[File:Whitebox in toolkit.png|500px]] |
||
===Import DEM into QGIS=== |
|||
Import the DEM you downloaded into QGIS by adding it as a layer. You can do this by finding the layer in the QGIS browser or simply dragging it from the directory into QGIS. If it correctly imported, you should see the DEM displayed on the screen. |
|||
[[File:DataExa.PNG|600px]] |
|||
You should now be ready for analysis. |
|||
==Hydrological Analysis== |
==Hydrological Analysis== |
||
| Line 124: | Line 79: | ||
Pre-processing is an important first step in any hydrological analysis as this process identifies and corrects all features within the DEM that may disrupt the flow analysis. Since all products are derived from the DEM it is important to make these corrections at the begging of the process to prevent these errors from carrying through into all of the hydrological outputs. |
Pre-processing is an important first step in any hydrological analysis as this process identifies and corrects all features within the DEM that may disrupt the flow analysis. Since all products are derived from the DEM it is important to make these corrections at the begging of the process to prevent these errors from carrying through into all of the hydrological outputs. |
||
All of the DEM Pre-Processing tools available in Whitebox can be found in the tools menu under the following directory: |
|||
Tools> Hydrological Analysis> DEM Pre-Processing |
|||
In this tutorial the "Fill Depressions" tool is used to hydrologically correct the DEM. This was chosen because it is much more computationaly efficient than any of the breach tools, finishing much quicker. |
|||
The first tool used in this tutorial is "Find No-Flow Cells", and can be found in the highlighted location in the image below. |
|||
This was used to identiy if there were any problem areas, and how extensive they were. |
|||
[[File:FindNoFlow.PNG]] |
|||
After double clicking the tool name in the tools list the dialogue box in the image bellow will appear. |
|||
Set the Calabogie area DEM as the "Input DEM Raster File". |
|||
Make sure that the "Output Raster File" will be saved within the DataProducts folder in the directory you set up and give it a name similar to "FindNoFlow.dep". |
|||
After these inputs have been set click "Run" in the bottom left of the popup window. |
|||
[[File:FindNoFlowMsg.PNG]] |
|||
After the tool runs it will produce a file that looks like the one below. The black areas in this image are all of the problem areas identified that could cause problems for flow analysis. These areas tend to correspond with errors in the DEM if they are small, or basins in the landscape if they are large. The high amount of no flow areas identified using this tool means that a pre-processing correction tool will be necessary. |
|||
[[File:FindNoFlowOtp.PNG|800px]] |
|||
In this tutorial the "Fill Depressions" tool is used to correct the no flow areas. This was chosen because it is much more computationaly efficient than any of the breach tools, finishing much quicker. |
|||
This tool is found in the location below. |
This tool is found in the location below. |
||
[[File:Fill. |
[[File:Fill depressions tool location.png]] |
||
The dialog box that appears for this tool is shown below. The input file should be set to the original Calabogie DEM |
The dialog box that appears for this tool is shown below. The input file should be set to the original Calabogie DEM. |
||
The "flat increment value" is the step value added to cells within a flat area in order to ensure that they have a slight slope instead of remaining flat. This was kept at the default value of "0.001". After these inputs have been set click "Run" in the bottom left of the popup window. |
|||
[[File: |
[[File:Fill depressions tool.png|600px]] |
||
The output of this tool is shown below. It does not appear very different to the original DEM, but will closer inspection differences within the areas identified in the Find No-Flow Cells output can be seen. |
The output of this tool is shown below. It does not appear very different to the original DEM, but will closer inspection differences within the areas identified in the Find No-Flow Cells output can be seen. |
||
[[File:FillDepressionsOtp.PNG| |
[[File:FillDepressionsOtp.PNG|600px]] |
||
===Flow Pointer=== |
===Flow Pointer=== |
||
| Line 166: | Line 102: | ||
This tool is found in the location shown below. |
This tool is found in the location shown below. |
||
[[File: |
[[File:D8 flow tool location.png]] |
||
The dialog box for this too is shown below. The input DEM raster file should be set to the output from the Fill Depressions tool |
The dialog box for this too is shown below. The input DEM raster file should be set to the output from the Fill Depressions tool. |
||
[[File: |
[[File:D8 flow tool.png|600px]] |
||
The output from this tool is displayed below. This image contained 8 colours corresponding to the 8 directions of flow. This image appears chaotic, but will be used in other tools to create more informative data products. |
The output from this tool is displayed below. This image contained 8 colours corresponding to the 8 directions of flow. This image appears chaotic, but will be used in other tools to create more informative data products. |
||
[[File:FlowPointerOtp.PNG| |
[[File:FlowPointerOtp.PNG|600px]] |
||
===Flow Accumulation=== |
===Flow Accumulation=== |
||
| Line 181: | Line 117: | ||
This is useful on its own, allowing us to determine the relative flow through areas by comparing values of the output, and is also used as an input for many other analyses. |
This is useful on its own, allowing us to determine the relative flow through areas by comparing values of the output, and is also used as an input for many other analyses. |
||
In this tutorial the "D8 |
In this tutorial the "D8 Flow Accumulation" tool was used, as this was the one that corresponded to the D8 Flow Pointer output that was created with the previous tool. |
||
This tool is located in the location displayed below. |
This tool is located in the location displayed below. |
||
[[File: |
[[File:D8 accumulation tool location.png]] |
||
The dialog box for this tool is displayed below. The input D8 flow pointer raster file should be set to the output from the D8 flow pointer tool |
The dialog box for this tool is displayed below. The input D8 flow pointer raster file should be set to the output from the D8 flow pointer tool. In the example the "Output Type" was set to "cells" so that a greater cell value in the output would correspond to a greater number of cells flowing through that cell. The "Log-transform output" box was left unchecked in this example, though checking this would help normalize the data for better display. After these inputs have been set click, run the tool. |
||
[[File: |
[[File:D8 accumulation tool.png|600px]] |
||
The output of this tool is displayed below. The brighter areas correspond to areas of higher accumulated flow. These areas of high flow correspond to the areas where more water gathers and flows together. A beter picture of the data can be gathered by zooming into the output in Whitebox. |
The output of this tool is displayed below. The brighter areas correspond to areas of higher accumulated flow. These areas of high flow correspond to the areas where more water gathers and flows together. A beter picture of the data can be gathered by zooming into the output in Whitebox. |
||
[[File:FlowAccumulationOtp.PNG| |
[[File:FlowAccumulationOtp.PNG|600px]] |
||
===Isobasin=== |
===Isobasin=== |
||
| Line 200: | Line 136: | ||
The location of this tool is displayed below. |
The location of this tool is displayed below. |
||
[[File: |
[[File:Isobasins tool location.png]] |
||
The dialog box for this tool is displayed below. The input is the original, hydrologically conditioned (depression fill) raster. |
|||
The dialog box for this tool is displayed below. The input D8 flow pointer raster file should be set to the output from the D8 flow pointer tool (FlowPointer.dep), and the input contributing area file sould be set to the output from the D8 and Rho8 Flow Accumulation tool (FlowAccumulation.dep). The output should be set to the DataProducts folder and named something similar to "Isobasin.dep". |
|||
For this example the "Target Basin Size" was set to 500,000 cells. This value was found using trial an error to find an output that looked appropriate. After these inputs have been set click "Run" in the bottom left of the popup window. |
|||
[[File: |
[[File:Isobasins tool.png|600px]] |
||
The output from this look is displayed below. It can be seen that the area has been broken down into 11 different basins of approximately equal size. It also appears that the basins do not fill the entire study area. This is likely because no more basins of a size of 500,000 cells could be fit into these areas. If the target basin size was set to a lower number these basins would conform to the study area more completely. |
The output from this look is displayed below. It can be seen that the area has been broken down into 11 different basins of approximately equal size. It also appears that the basins do not fill the entire study area. This is likely because no more basins of a size of 500,000 cells could be fit into these areas. If the target basin size was set to a lower number these basins would conform to the study area more completely. |
||
[[File:IsobasinOtp.PNG| |
[[File:IsobasinOtp.PNG|600px]] |
||
===Extract Streams=== |
===Extract Streams=== |
||
| Line 215: | Line 150: | ||
Stream networks can be useful as an input for other tools. Also, on their own they allow knowledge of areas of high water and nutrient flow, as well as connecting areas between water habitats. |
Stream networks can be useful as an input for other tools. Also, on their own they allow knowledge of areas of high water and nutrient flow, as well as connecting areas between water habitats. |
||
The "Extract Streams" tool was used for this purpose. This tool extracts all values from a flow accumulation output that are greater than the specified value. This tool |
The "Extract Streams" tool was used for this purpose. This tool extracts all values from a flow accumulation output that are greater than the specified value. This tool is part of the "Stream Network Analysis" toolset. |
||
The location of this tool is displayed below. |
The location of this tool is displayed below. |
||
[[File: |
[[File:Extract streams tool location.png]] |
||
The dialog box for this tool is displayed below. The input flow-accumulation raster file should be set to the output from the D8 |
The dialog box for this tool is displayed below. The input flow-accumulation raster file should be set to the output from the D8 Flow Accumulation (D8 Flow Accumulation). The "Channelization Threshold" is the cutoff value that will be used to determine which cells are a stream and which cells aren't. Trial and error was used to determine a value that produced an appropriate stream network. A value of 5,000 was settled on. Please make sure to check the "If true, non-stream background is 0 instead of NoData" box. This is because later tools in this analysis require rasters without NoData values. |
||
[[File: |
[[File:Extract streams tool.png|600px]] |
||
The output of the tool is displayed below. This output looks patchy at the full extent, but by zooming into it within Whitebox you can confirm that a network of continuous lines has been produced. |
The output of the tool is displayed below. This output looks patchy at the full extent, but by zooming into it within Whitebox you can confirm that a network of continuous lines has been produced. |
||
[[File:ExtractStreamsOtp.PNG| |
[[File:ExtractStreamsOtp.PNG|600px]] |
||
===Sub-basins=== |
===Sub-basins=== |
||
| Line 233: | Line 168: | ||
The location of this tool is displayed below. |
The location of this tool is displayed below. |
||
<br> |
|||
[[File:Subbasins. |
[[File:Subbasins tool location.png]] |
||
<br> |
|||
The dialog box for this tool is displayed below. The input streams raster file should be set to the output from the extract streams tool |
The dialog box for this tool is displayed below. The input streams raster file should be set to the output from the extract streams tool, and the input D8 flow pointer raster should be set to the output from the D8 flow pointer tool . After these inputs have been set, run the tool. |
||
<br> |
|||
[[File: |
[[File:Subbasins tool.png|600px]] |
||
<br> |
|||
The output from this tool is displayed below. This image shows a much greater number of basins than any of the outputs from other tools in this tutorial, likely due to the complexity of the stream network fed into the tool. It would be expected that if the channelization threshold used for the extract streams tool was higher, there would be less sub-basins, and if it was lower there would be more. |
The output from this tool is displayed below. This image shows a much greater number of basins than any of the outputs from other tools in this tutorial, likely due to the complexity of the stream network fed into the tool. It would be expected that if the channelization threshold used for the extract streams tool was higher, there would be less sub-basins, and if it was lower there would be more. |
||
<br> |
|||
[[File:SubbasinsOtp.PNG| |
[[File:SubbasinsOtp.PNG|600px]] |
||
===Watershed Analysis=== |
===Watershed Analysis=== |
||
| Line 249: | Line 189: | ||
Pour points are used in watershed analysis to define each of the watersheds that will be output. Simply put, a watershed is the entire area that flows into a pour point. As a result the placement of these pour points greatly effects the output of the watershed analysis. Pour points are usually located in areas of high accumulated flow, so are usually located on points of a stream network. |
Pour points are used in watershed analysis to define each of the watersheds that will be output. Simply put, a watershed is the entire area that flows into a pour point. As a result the placement of these pour points greatly effects the output of the watershed analysis. Pour points are usually located in areas of high accumulated flow, so are usually located on points of a stream network. |
||
There is no way to create a pour point file in Whitebox automaticaly, so this must be done manualy. |
There is no way to create a pour point file in Whitebox automaticaly, so this must be done manualy. You can do this by creating a new point layer in QGIS. Go to layer > Create layer |
||
The first step in making a pour point file is to make a blank file. This is achieved using the "Create Blank Outlet Raster" tool, which creates a file that is identical to the input file, except that every cell contains "NoData" values. |
|||
[[File:Create new layer location.png | 400px]] |
|||
The location of this tool is displayed in the following image. |
|||
You can create whichever data structure you prefer for vectors, for this tutorial we use a shapefile. Make sure to set your CRS to the same CRS as the hydrological products that have already been created. Then set the geometry type to Point. Your dialog box may look something like below. |
|||
[[File:BlankOutletRaster.PNG]] |
|||
[[File:Create points layer.png | 500px]] |
|||
The dialog box of this tool is displayed below. The input raster file should be set to the original Calabogie DEM file and the output should be set to the DataProducts folder and named something similar to "OutletRaster.dep". After these inputs have been set click "Run" in the bottom left of the popup window. |
|||
Pour points must now be identified and added. Before this can be done, the layers in the data tab have to be set up. I made sure that only the extract streams output and the create blank outlet raster output were visible. |
|||
[[File:BlankOutletRasterMsg.PNG|800px]] |
|||
Next the vector layer must be set to editing mode, start by enabling editing like so. |
|||
The output of this tool will be a blank raster file. |
|||
[[File:Toggle editing.png]] |
|||
Pour points must now be identified and added. Before this can be done, the layers in the data tab have to be set up. I made sure that only the extract streams output and the create blank outlet raster output were visible, and that only the create blank outlet raster output was highlighted in the layer list. |
|||
You can then create points from here by first clicking on the 'Add Point Feature' button |
|||
Next the Modify Pixel Values tool must be used. The location of this tool is displayed below. |
|||
[[File: |
[[File:Add point feature.png]] |
||
After clicking this button your cursor will become a cross-hair when mousing over your data frame. The center of this cross-hair is the location of the pixel that will be altered using this tool. |
After clicking this button your cursor will become a cross-hair when mousing over your data frame. The center of this cross-hair is the location of the pixel that will be altered using this tool. |
||
Click on a location along the stream network, such as the location displayed below. |
Click on a location along the stream network, such as the location displayed below. When you click on it a small window like the one below will appear. Give your point an a unique ID so that it can be saved in the vector. |
||
[[File: |
[[File:Place pour point.png|500px]] |
||
When you click a small window like the one below will appear. This window tells you the co-ordinates of the pixel you are changing, and the current value of the pixel. The value should currently be NoData. |
|||
Change this value from NoData to 1. |
|||
[[File:ModifyPixelToolMsg.png]] |
|||
Repeat this process until you are happy with the placement of your pour points, making sure that the value of each pour point is unique. |
Repeat this process until you are happy with the placement of your pour points, making sure that the value of each pour point is unique. |
||
For the example in this tutorial 10 pour points were spread evenly along the stream network and were given sequential values from 1 to 10. |
For the example in this tutorial 10 pour points were spread evenly along the stream network and were given sequential values from 1 to 10. |
||
It is important that the placement of these pour points is on the stream network, so the Jenson Snap Pour Points tool will now be used to make sure that this is true. |
It is important that the placement of these pour points is on the stream network, so the Jenson Snap Pour Points tool will now be used to make sure that this is true. |
||
| Line 288: | Line 220: | ||
The location of this tool is displayed below. |
The location of this tool is displayed below. |
||
[[File:Jenson snap pour points tool location.png]] |
|||
[[File:SnapPourPoints.PNG]] |
|||
The dialog box for this tool is displayed below. The input streams raster should be set to the output from the extract streams tool. After these inputs have been set, run the tool. |
|||
[[File:Jenson snapped pour points.png | 500px]] |
|||
The dialog box for this tool is displayed below. The input outlets file should be set to the output from the create blank outlet raster tool that you have just modified (OutletRaster.dep). The input streams raster should be set to the output from the extract streams tool (ExtractStreams.dep). The output should be set to the DataProducts folder and named something similar to "PourPoints.dep". After these inputs have been set click "Run" in the bottom left of the popup window. |
|||
After this you will get a new point layer that is perfectly snapped to the stream network. Use this point layer for future analysis instead of your manually created layer. |
|||
[[File:SnapPourPointsMsg.PNG|800px]] |
|||
====Watershed==== |
====Watershed==== |
||
| Line 298: | Line 232: | ||
Now that the pour point raster has been created and snapped to the stream network the watershed analysis can be undergone. The location of this tool is displayed below. |
Now that the pour point raster has been created and snapped to the stream network the watershed analysis can be undergone. The location of this tool is displayed below. |
||
[[File: |
[[File:Watersheds tool location.png]] |
||
The dialog box for this tool is displayed below. The D8 flow pointer raster file should be set to the output from the D8 flow pointer tool |
The dialog box for this tool is displayed below. The D8 flow pointer raster file should be set to the output from the D8 flow pointer tool. The pour point file should be set to the output from the Jenson snap pour points tool. After these inputs have been set, run the tool. |
||
[[File: |
[[File:Watersheds tool.png|600px]] |
||
The output of this tool is displayed below. This shows 10 watershed ares, corresponding to the locations that the pour points were located. Each of these watersheds also conserve the value that its pour point had, meaning that any hierarchy or numbering system will be kept. |
The output of this tool is displayed below. This shows 10 watershed ares, corresponding to the locations that the pour points were located. Each of these watersheds also conserve the value that its pour point had, meaning that any hierarchy or numbering system will be kept. |
||
| Line 308: | Line 242: | ||
The number and location of your watershed areas will differ as a result of the different pour points used. |
The number and location of your watershed areas will differ as a result of the different pour points used. |
||
[[File:WatershedOtp.PNG| |
[[File:WatershedOtp.PNG|600px]] |
||
==Conclusion== |
==Conclusion== |
||
Latest revision as of 14:58, 9 October 2026
Contents
Introduction
This tutorial uses Whitebox tools, an open source GIS software that was developed within the Center for Hydrogeomatics in Guelph University. As a result this software package has a heavy focus on hydrological analysis. For this reason Whitebox was chosen for this tutorial on hydrological analysis. WhiteBox has recently been completely re-written from the ground up using a more advanced backend. This means that the toolset has migrated away from a stand-a-lone software. It is now accessible either through code (Python or R) or as a package using QGIS. This tutorial originally used the older version but has been updated to use the QGIS version in October 2026.
The area of focus in this tutorial is Calabogie Ontario. This location was chosen because the Calabogie peak adds some relief to the area, and the author knew it well enough to tell if there were any errors that occurred during the analysis process.
This tutorial uses a single input, a Digital Elevation model, and produces a multitude of outputs from it, adding information that could be used for future analysis. The process that will be undergone in this tutorial is displayed in the image below. To understand the context of each tool used in this tutorial please refer back to this image as needed.
Data Acquisition
In this tutorial the only necessary layer is a Digital Elevation Model (DEM) file of your area of interest. In this tutorial we are focusing on Calabogie, ON. It is recommended that you use tthis same dataset for following along.
It can be acquired and downloaded here.
A sample of this data is shown bellow.
For the event that the dropbox link has become inactive the process of obtaining this data is described below to make this tutorial relevant for longer.
Access the Government of Canada Geospatial Data Extraction Application here.
In the “Select Clipping Area” bar enter change the selection to "Predefined Clipping Area" and then select "Drainage areas" from the drop down list that appears.
This produces a long list of sequential drainage area names. Search through the names until you find "02KE000" and select it. I found this on the 17th page of drainage area names.
The map extent on the right side of the web page should now match the image below.
Under “Select Data to be extracted” Select “Elevation – Digital elevation model”.
Under “Select options and submit job” fill all of the required boxes so that it matches the figure below. Make sure to enter the email address that you would like to have the file sent to in the “Email Address” field.
An email will be sent to the entered email address shortly which contains a URL for the direct download of the data.
If neither of these options are available, any DEM raster can be used.
Acquiring and Installing Whitebox Plugin (QGIS)
Please note the previous version of Whitebox used for this tutorial is now deprecated and has transitioned to be used via coding APIs or QGIS only. This tutorial will now use Whitebox Geospatial Analysis Tools in QGIS instead of the older version. This tutorial presumes the user has some QGIS knowledge and already has QGIS installed. For more details, please see the the QGIS download page for more instructions.
To setup your QIGS workspace for WhiteBox you will need to install the "WhiteBox Workflows for QGIS" plugin.
To start, find the plugin manager in QGIS by going to plugins > Manage and Install Plugins...
Then search all plugins for "WhiteBox Workflows for QGIS"
Install the plugin, once that is finished please move on to the next section.
Getting Started
Accessing WhiteBox Tools
You're now all set to start using WhiteBox Tools. If you do not see them go to Processing > Toolbox to display the window.
You will find the whitebox tools displayed at the bottom of the list. These tools will be used for the rest of the tutorial so please make sure you have access to them as shown here.
Import DEM into QGIS
Import the DEM you downloaded into QGIS by adding it as a layer. You can do this by finding the layer in the QGIS browser or simply dragging it from the directory into QGIS. If it correctly imported, you should see the DEM displayed on the screen.
Hydrological Analysis
DEM Pre-Processing
Pre-processing is an important first step in any hydrological analysis as this process identifies and corrects all features within the DEM that may disrupt the flow analysis. Since all products are derived from the DEM it is important to make these corrections at the begging of the process to prevent these errors from carrying through into all of the hydrological outputs.
In this tutorial the "Fill Depressions" tool is used to hydrologically correct the DEM. This was chosen because it is much more computationaly efficient than any of the breach tools, finishing much quicker.
This tool is found in the location below.
The dialog box that appears for this tool is shown below. The input file should be set to the original Calabogie DEM.
The output of this tool is shown below. It does not appear very different to the original DEM, but will closer inspection differences within the areas identified in the Find No-Flow Cells output can be seen.
Flow Pointer
A flow pointer tool in Whitebox is a tool that identifies which area surrounding a cell is the lowest. The value of this cell is then assigned corresponding to the relative direction of this area. This information is not too useful on its own, but it is used as an input to many other hydrology tools because it denotes the direction that water will flow from each cell.
Whitebox has many different flow pointer tools that each use a different method to produce their results. In this tutorial "D8 Flow Pointer" was used because many of the tools in the "Watershed Tools" toolset will only work with the output from the D8 Flow Pointer as an input. This tool is found in the location shown below.
The dialog box for this too is shown below. The input DEM raster file should be set to the output from the Fill Depressions tool.
The output from this tool is displayed below. This image contained 8 colours corresponding to the 8 directions of flow. This image appears chaotic, but will be used in other tools to create more informative data products.
Flow Accumulation
Flow Accumulation tools analyze the magnitude of cells that pour into or through an area. This is useful on its own, allowing us to determine the relative flow through areas by comparing values of the output, and is also used as an input for many other analyses.
In this tutorial the "D8 Flow Accumulation" tool was used, as this was the one that corresponded to the D8 Flow Pointer output that was created with the previous tool. This tool is located in the location displayed below.
The dialog box for this tool is displayed below. The input D8 flow pointer raster file should be set to the output from the D8 flow pointer tool. In the example the "Output Type" was set to "cells" so that a greater cell value in the output would correspond to a greater number of cells flowing through that cell. The "Log-transform output" box was left unchecked in this example, though checking this would help normalize the data for better display. After these inputs have been set click, run the tool.
The output of this tool is displayed below. The brighter areas correspond to areas of higher accumulated flow. These areas of high flow correspond to the areas where more water gathers and flows together. A beter picture of the data can be gathered by zooming into the output in Whitebox.
Isobasin
The isobasin tool divides a study area into equally sized drainage areas (iso-basins) of a specified size.
The location of this tool is displayed below.
The dialog box for this tool is displayed below. The input is the original, hydrologically conditioned (depression fill) raster.
The output from this look is displayed below. It can be seen that the area has been broken down into 11 different basins of approximately equal size. It also appears that the basins do not fill the entire study area. This is likely because no more basins of a size of 500,000 cells could be fit into these areas. If the target basin size was set to a lower number these basins would conform to the study area more completely.
Extract Streams
Stream networks can be useful as an input for other tools. Also, on their own they allow knowledge of areas of high water and nutrient flow, as well as connecting areas between water habitats.
The "Extract Streams" tool was used for this purpose. This tool extracts all values from a flow accumulation output that are greater than the specified value. This tool is part of the "Stream Network Analysis" toolset. The location of this tool is displayed below.
The dialog box for this tool is displayed below. The input flow-accumulation raster file should be set to the output from the D8 Flow Accumulation (D8 Flow Accumulation). The "Channelization Threshold" is the cutoff value that will be used to determine which cells are a stream and which cells aren't. Trial and error was used to determine a value that produced an appropriate stream network. A value of 5,000 was settled on. Please make sure to check the "If true, non-stream background is 0 instead of NoData" box. This is because later tools in this analysis require rasters without NoData values.
The output of the tool is displayed below. This output looks patchy at the full extent, but by zooming into it within Whitebox you can confirm that a network of continuous lines has been produced.
Sub-basins
The sub-basin tool breaks the down the study area into a number of basins, with one basin for each segment of a stream network for the area. As a result each of these basins represent the catchment area for each segment of the river network.
The location of this tool is displayed below.
The dialog box for this tool is displayed below. The input streams raster file should be set to the output from the extract streams tool, and the input D8 flow pointer raster should be set to the output from the D8 flow pointer tool . After these inputs have been set, run the tool.
The output from this tool is displayed below. This image shows a much greater number of basins than any of the outputs from other tools in this tutorial, likely due to the complexity of the stream network fed into the tool. It would be expected that if the channelization threshold used for the extract streams tool was higher, there would be less sub-basins, and if it was lower there would be more.
Watershed Analysis
In order to run the Watershed tool this first step will be to create pour points. Once this is done The watershed analysis can be done.
Pour Points
Pour points are used in watershed analysis to define each of the watersheds that will be output. Simply put, a watershed is the entire area that flows into a pour point. As a result the placement of these pour points greatly effects the output of the watershed analysis. Pour points are usually located in areas of high accumulated flow, so are usually located on points of a stream network.
There is no way to create a pour point file in Whitebox automaticaly, so this must be done manualy. You can do this by creating a new point layer in QGIS. Go to layer > Create layer
You can create whichever data structure you prefer for vectors, for this tutorial we use a shapefile. Make sure to set your CRS to the same CRS as the hydrological products that have already been created. Then set the geometry type to Point. Your dialog box may look something like below.
Pour points must now be identified and added. Before this can be done, the layers in the data tab have to be set up. I made sure that only the extract streams output and the create blank outlet raster output were visible.
Next the vector layer must be set to editing mode, start by enabling editing like so.
You can then create points from here by first clicking on the 'Add Point Feature' button
After clicking this button your cursor will become a cross-hair when mousing over your data frame. The center of this cross-hair is the location of the pixel that will be altered using this tool.
Click on a location along the stream network, such as the location displayed below. When you click on it a small window like the one below will appear. Give your point an a unique ID so that it can be saved in the vector.
Repeat this process until you are happy with the placement of your pour points, making sure that the value of each pour point is unique. For the example in this tutorial 10 pour points were spread evenly along the stream network and were given sequential values from 1 to 10.
It is important that the placement of these pour points is on the stream network, so the Jenson Snap Pour Points tool will now be used to make sure that this is true.
The location of this tool is displayed below.
The dialog box for this tool is displayed below. The input streams raster should be set to the output from the extract streams tool. After these inputs have been set, run the tool.
After this you will get a new point layer that is perfectly snapped to the stream network. Use this point layer for future analysis instead of your manually created layer.
Watershed
Now that the pour point raster has been created and snapped to the stream network the watershed analysis can be undergone. The location of this tool is displayed below.
The dialog box for this tool is displayed below. The D8 flow pointer raster file should be set to the output from the D8 flow pointer tool. The pour point file should be set to the output from the Jenson snap pour points tool. After these inputs have been set, run the tool.
The output of this tool is displayed below. This shows 10 watershed ares, corresponding to the locations that the pour points were located. Each of these watersheds also conserve the value that its pour point had, meaning that any hierarchy or numbering system will be kept.
The number and location of your watershed areas will differ as a result of the different pour points used.
Conclusion
This tutorial aimed to give the user in introduction to hydrological analysis using Whitebox GAT 3.4.0. This was done by taking the user through an organized process that linked many of the hydrology tools together and explained why they were used and how the parameters were decided for each one.
The user should now have a good basis of knowledge that will help them with future hydrological analysis in Whitebox Geospatial Analysis Tools.










