MapSWAT
MapSWAT is a QGIS plugin for generating ready-to-use SWAT or SWAT+ input maps.
Why MapSWAT? • Installation • Key Points • How To Use • Future Developments • Credits • Contact • Support
Why MapSWAT?
- MapSWAT optimizes the process of obtaining and preparing the input maps for both QGIS versions of SWAT (Soil and Water Assessment Tool), QSWAT and QSWAT+. As you know, the SWAT model required: a digital elevation map (DEM), a land use map (LANDUSE) and a soil map (SOIL). Obtaining and pre-processing these SWAT input maps can be a laborious and time-consuming task. With the new version of MapSWAT, the necessary SWAT input maps can be obtained and formatted in less than one minute for any part of the world, substantially reducing the time spent to pre-process them, as well as excluding possible formatting errors. The MapSWAT plugin can be a useful tool for beginners or advanced SWAT users who wish to quickly and accurately obtain and prepare the SWAT input maps. This allows them to focus on other more important parts of the hydrological modelling, such as calibration and validation.
In case you are not yet fully convinced to use it. Below is an example of MapSWAT’s potential.
Installation
Download
- You can download here the latest installable version of MapSWAT for Windows.
Initial Setup
-
Before installing the MapSWAT plugin, it is necessary to download and install QGIS 3.x. It is recommended to use the long-term release version.
-
MapSWAT needs to get access to Google Earth Engine (GEE). In order to use GEE, registration is required at https://signup.earthengine.google.com. After this process, you will have access to the Code Editor of GEE.
After accessing the Code Editor, go to Profile > Project Info and copy your Cloud Project ID (this information will be needed to configure MapSWAT for the first time).
- Launch a QGIS 3 project, navigate to Plugins > Manage and Install Plugins > All, and then search for “Google Earth Engine” plugin.
- The MapSWAT can now be installed. Launch the downloaded MapSWAT executable, reboot the QGIS program and then activate the MapSWAT plugin from QGIS repository (Plugins > Manage and Install Plugins > Installed).
- After activating the MapSWAT plugin for the first time, you will see the following message. Users must register with their Google Earth Engine (GEE) account. If an error occurs during this step (localhost:8085), return to QGIS and launch the MapSWAT plugin from the QGIS toolbar. Check if the MapSWAT GEE version works.
If you cannot connect to MapSWAT GEE, make sure you are entering the correct GEE Cloud Project ID. For example: ee-myproject.
Key Points
-
MapSWAT is a single-use program, which means that when the program is closed all generated files will be deleted from QGIS canvas. However, all files will be still available in the MapSWAT folder.
-
MapSWAT will only create the selected input maps, so remember to tick the box for each input map to generate them.
-
If a python error appears during the use of MapSWAT, it is recommended to reboot the QGIS program to fix it. If it continues, please contact me.
How To Use
- Click on the MapSWAT button of the QGIS toolbar to open the MapSWAT plugin. You will be prompted to select the version of MapSWAT you want to use.
MapSWAT v3.0: This is the Standard version of MapSWAT. Users can import their own raster maps and prepare them in SWAT or SWAT+ format.
MapSWAT GEE: This is the Connected to Google Earth Engine (GEE) version of MapSWAT. Users must first sign up for a GEE account and install the GEE plugin from the QGIS repository. The first time you use this version, you will need to enter your GEE Cloud Project ID.
- Before going to the selected MapSWAT version, users also have to indicate a path to save the MapSWAT folder.
- Both versions are structured in the same way.
- In the first part of the MapSWAT window, users can insert or select the raster layers such as, a digital elevation map (DEM), a land use map (LANDUSE) and a soil map (SOIL). Remember to tick the box of the SWAT input map you want to obtain.
Before moving on to the next part, users can also introduce an outlet point coordinates to easily locate the study area in the map canvas. This will unlock additional options such as BUFFER CLIP or AUTOBASIN CLIP.
- When previous steps have been done, users have to click on ADD LAYERS or GET MAPS to activate the following part of the MapSWAT plugin.
Additionally, a MERGE DEMs option has been included in the standard version of MapSWAT. To use it, user must click on the MERGE DEMs button, select the DEM layers (.tif) to merge and click on the OPEN button.
- CLIPPING OPTIONS: MapSWAT includes several options for clipping raster layers.
- MANUAL CLIP: Allows users to manually draw an extraction mask (POLYGON).
After drawing the extraction mask, right-click the mouse and a window for indicating the FID number will appear. Set any number, for example 1, and click the OK button.
- SHAPEFILE CLIP: Allows users to select any shapefile as an extraction mask (POLYGON).
If you are using a shapefile from your study area, make sure it has only one attribute.
- BUFFER CLIP: With this option, an extraction mask (POLYGON) is automatically created around the outlet point. To do so, users have to indicate the buffer distance in kilometers (10 Km by default).
- AUTOBASIN CLIP: This option is only available in the GEE version, a predefined basin is obtained from HydroSHEDS Basins to be used as an extraction mask (POLYGON).
- SWAT INPUT MAPS CRS: This is the last part of the MapSWAT window, in this step users have to indicate a target CRS to reproject all generated maps.
The target CRS needs to be a metric CRS, for example UTM.
- Now, the created raster layers (“DEM”, “LANDUSE” and “SOIL”) can be found in the QGIS canvas.
Additionally, for the LANDUSE and SOIL input maps a template of their LOOKUP tables is automatically created.
- When closing, a warning window is displayed to remind users that the QGIS canvas will be cleared and all uploaded files will disappear.
Future Developments
- Global input maps require by GWFLOW (already implemented in version 3.1 😉).
- Extract climate data from GEE in SWAT/SWAT+ format.
- Upload to the QGIS plugin repository.
- More DEM, LULC, and SOIL databases (looking for collaboration 👫 or ideas 💡).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any suggestions you make are greatly appreciated.
Credits
This software uses the following open source packages:
Contact
If you have feedback or suggestions, please contact me at alopez6@ucam.edu.
Support
If you find this plugin useful, or if it has saved you time in your work, consider supporting it by inviting me for a coffee. Thanks! 😊