Tute M04 QGIS 1D2D Breaklines Archive

From Tuflow
Jump to navigation Jump to search

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

  1. 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".
  2. TYPE = 'HX'
  3. 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.
  4. 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.
  5. From the menu select Plugins >> mmqgis >> Modify >> Convert Geometry Type.
  6. QGIS Lines to Points.jpg
  7. 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
    Select ok to complete the conversion.
  8. Ensure the DEM (DEM_M01) is open.
  9. 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.
  10. QGIS Plugin PointSamplingTool Use.png
  11. 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.
  12. Tute M04 QGIS 2d breaklines 03.jpg

  13. 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 ("").
  14. 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.
  15. 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.
  16. M04 Field Calculator Marked.png

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.