Tute M04 QGIS 1D2D Breaklines Archive
Introduction
In this section we will define within the model the elevation of the 2D cells activated by the HX lines we created in the previous step. The elevation of the HX activated cells control the flux between the 1D and 2D domains, and so it is important that the cell elevations reflect the true water level required for flow to cross the HX boundaries.
As we have the HX lines in a 2d_bc format, we can add the elevation points in the same format. Alternatively, we could use the 2D Z Shape (2d_zsh) format that was used in module three of the tutorial. If using this format it is important to ensure that a "thick" breakline format is used (by specifying a width greater than 0, and less than 1.5 times the cell size).
To create the breaklines we are going to convert the vertices along the "HX" lines to points and then sample the elevations from the DEM. Another method would be to create a buffer (region) around each of these points and sample for the maximum elevation within the buffer.
In order to convert the line vertices to points we will use a plugin called MMQGIS. For more information on this plugin please see http://michaelminn.com/linux/mmqgis/.
To inspect the elevations at the points we will use another plugin called Point Sampling Tool for more information see [[QGIS_Point_Sampling_Plugin | this QGIS tip].
Method
- Select all the "HX" lines from the 2d_bc_M04_HX_001_L layer. To do this use open the attribute table for the layer (right click on the layer in the Table of Contents and select Open Attribute Table. Use the select function "Type" equal to "HX".
- To create points from these we need to save these as a separate table. This will not be read into TUFLOW and can be deleted at the end of this step. Save the selection as tmp_M04_HX_lines. To export a selection as a new layer in QGIS, right click on the layer in the table of contents, select Save As... and check the box Save only selected features.
- Next we need to convert the vertices along these lines to points. This process uses the MMQGIS plugin described in the introduction. Ensure that the plugin has been loaded.
- From the menu select Plugins >> mmqgis >> Modify >> Convert Geometry Type.
- Set the following:
- The source layer to be the temporary file containing the HX lines (tmp_M04_HX_lines)
- The new geometry type to Nodes
- The output file to tmp_M04_HX_points
- Ensure the DEM (DEM_M01) is open.
- The next step is to inspect the elevations from the DEM. To do this we will use the point sampling plugin; make sure this is installed.
Once installed the plug can be accessed from the "Plugins >> Analyses" menu item. - Set the input layer as the intermediate tmp_M04_HX_points layer containing the points. Select all of the attributes on the tmp_M04_HX_points and also the DEM. These are the fields that are output. Set the output name as 2d_bc_M04_HX_001_Pand output this to the TUFLOW\model\gis\ folder. This file will be input to TUFLOW.
- Once the points have been created we need to update the "TYPE" attribute to "ZP". This tells TUFLOW that the points contain elevation points. To update the column, use the field calculator to update the "TYPE" attribute for all points to be "ZP". Set the "FLAGS" to blank ("").
- For elevation points contained in the 2d_bc format, we need to copy the values from the "dem_m01" column to the "f" column. To update this, open the attribute table and select Field Calculator.
- In the dialogue box select "Update existing field", choose column "f" from the drop down menu, in the "Expression" tab expand "Fields and Values" and double click on "dem_m01", click OK.
TYPE = 'HX'
Conclusion
The 2d_bc_M04_HX_001_P which contains elevation points for the "HX" line has been created. Please return to the tutorial where the next step is to deactivate the 2D cells in the creek areas.