Tute M03 QGIS 2d zsh Archive

From Tuflow
Jump to navigation Jump to search

    Introduction

    In this page, we import data from text file format into a QGIS file. Once the data is in QGIS format we will manipulate into a TUFLOW 2d Z Shape (2d_zsh) format ready for input into TUFLOW.

    Method

    Two separate sets of data have been provided in the \Module_Data\Module_03\. These are simple text files with the .xyz extension, as the name suggest these contain coordinates in a x, y and z format. In this case they are comma separated. A similar process could be used for space or tab delimited data.

    Importing Text Data

    The first step is to import that data into QGIS, to do this:

    1. In QGIS select Layer >> Add Delimited Text Data from the menu items.
    2. Navigate to the Module_Data\Module_03\ folder.
    3. In the Files of Type: drop down box, select Text files (*.txt *.csv).
    4. As the files have the extension .xyz not .txt, type "*.*" into the Filename section and hit enter.
    5. The .xyz files should now be visible, select the Creek_Centre_Line.xyz and select Open.
    6. Tute M03 QGIS ImportXYZ 01.png


    7. In the next dialogue the delimiter character can be specified, in this case it is a comma (","). Select the X and Y fields to X and Y respectively, as per the image below. Select OK.
    8. Tute M03 QGIS ImportXYZ 02.png


    9. The file should have opened and have point objects down the creek. If it is not already open the DEM ensure that the points are being displayed onto of the DEM. The points should appear as per the image below, with the points having X, Y and Z attributes. The next step is to manipulate the shapefile into a TUFLOW file format.
    10. Tute M03 QGIS ImportXYZ 03.png


    2d Z Shape Format

    1. Save a copy of the Creek_Centre_Line_XYZ into the TUFLOW\model\gis\ as 2d_zsh_M03_thalweg_001_P.shp.
    2. Close the Creek_Centre_Line_XYZ file down and open the 2d_zsh_M03_thalweg_001_P.shp file.
    3. We need to set the projection (coordinate reference system), to do this, right click on the 2d_zsh_M03_thalweg_001_P in the layer control and select Set Layer CRS.
    4. In the dialogue specify the CRS as 'WGS 84 / UTM Zone 60 S. This is the projection of the TUFLOW model that we set in module 1.
    5. Tip: This should be in the recently used section at the bottom of the dialogue.
      Tute M01 QGIS projection2.png


      The 2d Z Shape (2d_zsh) format requires the input data to be in the format outlined in Table 4.8 of the 2010 TUFLOW manual. The first four columns of the table should contain the following attributes:

      • Z
      • dZ
      • Shape_Width_or_dMax
      • Shape_Options

      The first three are numerical fields ("real" type in QGIS) and the fourth a character field of length 20. The table can have additional columns, these will be ignored by TUFLOW.

    6. The file already has a "Z" attribute, but we need to add three additional fields, "dZ" (real), "Shape_Width_or_dMax (real) and Shape_Options (character - length 20). To create these fields, right click on the file in the layer control and select, Properties.
    7. In the Layer Properties dialogue, navigate to the Fields tab and toggle editing on. Select the New Column button and create the three fields as per the images below.
    8. Tute M03 QGIS 2d zsh 01.png
      Tute M03 QGIS 2d zsh 02.png
      Tute M03 QGIS 2d zsh 03.png
      Tute M03 QGIS 2d zsh 04.png


    9. To manipulate the order of the attributes in QGIS, we need to install a plugin. To do this, please install the "Table Manager" plugin using the method outlined in the Table Manager Plugin page.
    10. Once the plugin has been installed, select Plugins >>> Table >>> Table Manager. Using the Move Up and Move Down buttons, move the X and Y columns so the table has the following structure:
    11. Tute M03 QGIS 2d zsh 05.png


    12. The data contains only points, no lines have been provided, we will need to digitise these. To do this we need to create a line file in the 2d_zsh format. Open the 2d_zsh_empty_L.shp file from the TUFLOW\model\gis\empty\ folder and save a copy as '2d_zsh_M03_thalweg_001_L.shp close the template (empty) file and open the 2d_zsh_M03_thalweg_001_L file.
    13. We are going to create a line that joins the points together, this will need to snap to the points, make sure the points have snapping enable in the Settings >>> Snapping Options' dialogue.
    14. Starting at the upstream end, create a polyline joining the points together. The line should snap to all of the points. Make sure to terminate the line and restart it upstream and downstream of the road embankments.
    15. Tip: If you make a mistake the backspace key can be used to remove the last vertex digitised.
      Tute M03 QGIS 2d zsh 06.png


    16. For each of the lines, set the following attribute:
      • Z = 99 (this won't be used as the elevation data is provided in the points)
      • dZ = 0
      • Shape_Width_or_dMax = 0
      • Shape_Options = Min
      The "MIN" in the shape options only lowers the elevations if the elevation from the breakline is below the the existing elevations in the Zpts. "MIN", "LOWER" and "GULLY" all perform the same function. This will lower a continuous flowpath, by lowering cell centres and cell sides. We will examine the changes made to the model in the check file section later in this tutorial module.
      The breakline to represent the creek centre line is now ready for input into TUFLOW.
    17. Repeat the process described above:
      • Import the Road_Crest_Survey.xyz and create a new file called 2d_zsh_M03_Rd_Crest_001_P in the TUFLOW\model\gis\ directory;
      • Modify the table structure to match the 2d_zsh format; and
      • Create a new line layer from the 2d_zsh_empty_L.shp empty file named 2d_zsh_M03_Rd_Crest_001_L in the TUFLOW\model\gis\ directory;
      • Digitise three lines, one for each road, as per the image below.
      Tute M03 MI 2d zsh 05.png


    18. On the lines shown above, enter the following attributes:
      GIS Attribute Line 1 Line 2 Line 3
      Z 99 99 99
      dZ 0 0 0
      Shape_Width_or_dMax 5 0 0
      Shape_Options MAX MAX MAX

      As per the creek line above, the elevations are associated with the points and a dummy value of 99 is used on the line (the actual value is unimportant). If no points are in the layer, the elevation on the line object is used, i.e. the elevation along the line does not vary.
      As explained in Table 4.8 of the 2010 TUFLOW manual, for a line object the Shape_Width_or_dMax, controls the width of the breakline in metres. Depending on the cell size the following methods of application are used:

      • Shape_Width_or_dMax = 0 - a "thin" breakline is used, only elevations on the cell side are modified (no change in storage);
      • Shape_Width_or_dMax less than or equal to 1.5 times the cell size - a line of whole cells are modified (a "thick" breakline); or
      • Shape_Width_or_dMax greater the 1.5 times the cell size - a "wide" breakline, elevations in multiple cells are modified. Any Zpts within a distance of half the Shape_Width_or_dMax are modified.

      For the tutorial model a cell size of 5m is used, therefore, line 1 will be a "thick" formulation and line 2 and line 3 will be using a "thin" breakline. Later in the module we will looking at the check files to review which Zpts are modified.

    Conclusion

    Two datasets have been imported into QGIS and manipulated into a TUFLOW Z Shape format (2d_zsh). The next step is to modify the control files, please return to the module 3 page.