CE QUAL W2 Geometry Preprocessor QGIS Toolbar Plugin - EcohydrologyTeam/CEQUALW2geomTools GitHub Wiki
CE-QUAL-W2 Geometry Preprocessor QGIS Toolbar Plugin [DRAFT]
The first version of the CE-QUAL-W2 Geometry Preprocessor QGIS Toolbar is available. Please note that the preprocessor toolbar plugin is currently only compatible with QGIS. Please follow the instruction here to download and install QGIS.
Download Toolbar
The following link provides the GitHub repository for the CE-QUAL-W2 Geometry Preprocessor QGIS Toolbar. Please download all files and directories in the repository and maintain the existing directory structure of the repository: CE-QUAL-W2 Geometry Preprocessor QGIS Toolbar Plugin Files.
If the user is unfamiliar with GitHub features an easy way to download an entire repository would be to click on the green "Code" button on the root webpage for the repository, and from the menu that appears select "Download ZIP". This will download everything in the repository which will have other files not needed for the plugin. The plugin files will be in this zip files at ".../QGIS_plugin/cequal_bathy"
The example local directory shown below indicates where a copy of plugin repository should be saved so the toolbar works within QGIS. This example directory location is for user "jane_doe". Please note the user will need to create the "cequal_bathy" directory at the "plugins" directory level: C:/Users/jane_doe/AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins/cequal_bathy
Toolbar Functionality
After the plugin files have been copied to the appropriate QGIS subdirectory, the user will need to do two things within the QGIS program before using the toolbar:
-
Under the "Plugins" menu select "Manage and Install Plugins..." this will open the "Plugins" user interface; within the "Plugins" user interface please check (if not already checked) the "CE QUAL W2 Bathymetry PreProcessor" plugin check box. The toolbar should now be visible after the check box has been checked.
-
Either load or create a polyline shape file of the centerline of the waterbody feature that W-2 segments input files will be created for. To load an existing shape file open the "Data Source Manager" interface by clicking on the "Open Data Source Manager" button of the use the "Data Source Manager Toolbar", and use the "Vector Dataset(s)" feature to select an existing waterbody centerline polyline shape file. It is beyond the scope of this wiki entry to provide the details of how to create a polyline shape file from scratch, but the QGIS help files and/or online tutorials should be a sufficient guide.
Note: The user input centerline shape file must have a Coordinate Reference System (CRS) that is projected as opposed to geographic. A CRS is also known as a Spatial Reference System (SRS). Examples of a projected CRS are a state plane or Universal Transverse Mercator (UTM).
The CE-QUAL-W2 Geometry Preprocessor QGIS Toolbar has three button: "Create W-2 Segments", "Split W-2 Segments", and "Merge W-2 Segments".
The "Create W-2 Segments" button should be used first, and clicking on this button will display the "Create W2 Segment Polygons" interface. Three user inputs are needed before the "Create Polygons" button is clicked. The "Select Centerline Layer" pull down menu will allow the user to select previously loaded layers. The user should enter the "Number of CE-QUAL-W2 Segments" in the spinner box by typing positive integers or using the spinner controls (default is set to 100 segments). The user will also need to enter the "CE-QUAL-W2 Segment Width" with the same units as the centerline shape file provided in the spinner box by typing positive integers or using the spinner controls (default is set to 50 units).
After the "Create Polygons" button is clicked, three temporary QGIS layers will be created: "Centerline", "Transects", and "Segments". These layers are temporarily stored in memory, but each can be saved to local directories. These three layers will also be required to generate ASCII files with bathymetry information. The "Transects" temporary layer shows the perpendicular transects to the centerline used to develop the polygon segments with a defined symbology (green with a thicker line width). The "Segments" temporary layer depicts the areas where the plugin will generate W2 segment bathymetric inputs; the defined symbology for the "Segments" layer provides the user with information about the attributes of the polygon (Convex/Concave and Centerline In/Centerline Out). These conditions are flagged because the user may want to adjust the inputs to create polygons that are convex and completely contain the centerline. The "Centerline" temporary layer is based on the selected centerline layer with a defined symbology (blue with thicker line width) with added attribute fields (SEGMENT, ELWS, FRIC) required for the bathymetry file. The "Centerline" layer is also broken into individual line segments that correspond to the "Segments" polygon layer. This is required to determine the individual river length of each segment. If the "Create Polygons" button is clicked again it will write over these temporary layers.
The "Split W-2 Segments" button of the toolbar can also be used to further refine/adjust the "Transects" and "Segments" temporary layers. When this button is clicked the user may select polygon(s) that they want to be split in half. This splitting feature will write over the "Transects," "Segments," and "Centerline" temporary layers with the updated split polygons and the new transects.
The "Merge W-2 Segments" button of the toolbar can be used to join adjacent polygons into one segment. When this button is clicked the user may select two or more polygons next to each other and they will be joined. This merging feature will write over the "Transects," "Segments," and "Centerline" temporary layers with the updated merged polygon and remove the extra transect(s).
The "Export W-2 Segment Input Files" button of the toolbar can be used to export the formatted CE-QUAL-W2 geometry/bathymetry file when the user is satisfied with the layout of the "Segments" temporary layer. The user will need to load a digital elevation model (DEM) in a raster format within QGIS before this tool can be used. The DEM needs to cover the spatial extent of the "Segments" temporary layer. The DEM also needs to have both the topography and bathymetric elevations of the waterbody of interest incorporated into the DEM. When the "Export W-2 Segment Input Files" button is clicked the "Export W-2 Segment Input Files" will be displayed. The user will need to select which DEM should be processed for the W-2 input files in the "Select DEM" pull down menu. The user will also need to select a local or network directory location to save the W-2 input files within.
Generating Bathymetry Files
The preprocessing tools developed within this plugin are intended to create GIS shapefiles that define the river network and extent of the model domain. The generated shapefiles are created to be compatible with an existing CE QUAL W2 QGIS plugin ("CE-QUAL-W2_Bathymetry") that can create ASCII based bathymetry files. That plugin can be downloaded via the QGIS interface, and is documented with its own wiki page (https://github.com/WQDSS/qgis-cequalw2-bath/wiki). All of the shapefiles contain the required attribute fields needed to run the external plugin.
Current Limitations
Below is a list of the known limitations with this plugin
General
The toolbar currently does not handle stream branches. However, a branched network could be accommodated by treating each reach individually.
Splitting Polygons
The tool to split polygons will split any selected polygon in half, while maintaining transects that are perpendicular to the stream centerline, and will maintain the same specified width of the original polygon layer. While this works in the vast majority of cases, in situations where there are extreme bends in the river, the transect lines may cross if the width is maintained. This results in inappropriate polygon creation. Care should be made to limit the use of the splitting tool in these circumstances, and manual manipulation of the layers may be required.
Interacting with External Plugin
As noted above, the shapefiles that this plugin creates are intended to be compatible with the external plugin "CE-QUAL-W2_Bathymetry", which computes volumes and generates bathymetry text files. The external plugin documentation should be referenced to ensure that an appropriate DEM is used and the resulting files should be inspected to ensure the SEGMENT IDs correspond to the appropriate location in the map.