Difference between revisions of "Tutorial M02 001 GIS Inputs QGIS GPKG"

From Tuflow
Jump to navigation Jump to search
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<span style="color:#FF0000">
 
<font size = 18>Page Under Construction</font>
 
</span>
 
 
= Introduction =
 
= Introduction =
 
QGIS is used to create, import and view input data.<br>
 
QGIS is used to create, import and view input data.<br>
Line 20: Line 17:
  
 
= Method =
 
= Method =
Create a GeoPackage Database for Module 2:
+
Set up the GeoPackage Database:
 
<ol>
 
<ol>
<li>Navigate to the '''Module_02\TUFLOW\model\gis''' folder.
+
<li>Navigate to the '''Module_02\TUFLOW\model\gis''' folder. Save a copy of '''M01_001.gpkg''' as '''M02_001.gpkg'''.
<li>Rename '''M01_001.gpkg''' as '''M02_001.gpkg'''.
+
<li>Within the QGIS Browser Panel, right click on 'Favorites' and select 'Add a Directory...'.
<li>From the QGIS Browser panel, right click on 'Favorites' and select 'Add a Directory...'.
 
 
<li>Navigate to the '''Module_02''' folder and select it.
 
<li>Navigate to the '''Module_02''' folder and select it.
 
</ol>
 
</ol>
  
From the QGIS Browser Panel, navigate to the '''Module_02\Tutorial_Data''' folder. Drag and drop the following layers in to the '''M02_001.gpkg''' database:
+
Within the QGIS Browser Panel, navigate to the '''Module_02\Tutorial_Data''' folder. Drag and drop the following layers into the '''M02_001.gpkg''':
 
:*'''2d_zsh_M02_rd_crest_001_L'''
 
:*'''2d_zsh_M02_rd_crest_001_L'''
 
:*'''2d_zsh_M02_rd_crest_001_P'''
 
:*'''2d_zsh_M02_rd_crest_001_P'''
 
+
<ol>
 +
<br>
 +
{{Video|name=Animation_M02_GPKG_GIS_001_0.mp4|width=1279}}<br>
 +
<br>
 +
</ol>
 
Investigate the supplied files:
 
Investigate the supplied files:
 
<ol>
 
<ol>
<li>Open the files, either:<br>
+
<li>Open the files, either:
:*Drag and drop '''M02_001.gpkg''' into the QGIS workspace, or  
+
:*Within the QGIS Browser Panel, navigate to '''M02_001.gpkg''' and double click the layers, or
:*In the Browser Panel, double click the files from within the '''M02_001.gpkg'''. <br>
+
:*In File Explorer, drag and drop the '''M02_001.gpkg''' into the QGIS workspace and select the layers (hold Ctrl to select multiple).  
 
<li>The 2d_zsh line layer represents the breaklines:
 
<li>The 2d_zsh line layer represents the breaklines:
 
:*No ‘Z’ attribute is specified, the elevations are taken from the 2d_zsh point layer.
 
:*No ‘Z’ attribute is specified, the elevations are taken from the 2d_zsh point layer.
Line 42: Line 42:
 
:*The Shape_Option of 'MAX' is specified for all breaklines. The Zpt elevations only changes when the Z shape elevation at the Zpt is higher. The purpose of the Z shape is to enforce the highest elevations along the road crest.
 
:*The Shape_Option of 'MAX' is specified for all breaklines. The Zpt elevations only changes when the Z shape elevation at the Zpt is higher. The purpose of the Z shape is to enforce the highest elevations along the road crest.
 
<br>
 
<br>
[[File:Animation_M02_GPKG_GIS_001_01a.gif]]<br>
+
{{Video|name=Animation_M02_GPKG_GIS_001_01b.mp4|width=1279}}<br>
 
<br>
 
<br>
 
<li>The 2d_zsh point layer is used to apply elevation to the breaklines:
 
<li>The 2d_zsh point layer is used to apply elevation to the breaklines:
 
:*The values in the 'Z' attribute are elevations above datum assigned to each point. The elevations are being interpolated along the breakline.  
 
:*The values in the 'Z' attribute are elevations above datum assigned to each point. The elevations are being interpolated along the breakline.  
:*The points must be snapped to the vertices of the 2d_zsh line to instruct TUFLOW that these layers are linked. 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. For more information, see Table 6-8 of the <u>[https://downloads.tuflow.com/_archive/TUFLOW/Releases/2018-03/TUFLOW%20Manual.2018-03.pdf 2018 TUFLOW Manual]</u>.
+
:*The points must be snapped to the vertices of the 2d_zsh line to instruct TUFLOW that these layers are linked. 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. For more information, refer to the <u>[https://docs.tuflow.com/classic-hpc/manual/latest/ TUFLOW Manual]</u>.
 
<br>
 
<br>
[[File:Animation_M02_GPKG_GIS_001_02a.gif]]<br>
+
{{Video|name=Animation_M02_GPKG_GIS_001_02a.mp4|width=1279}}<br>
 
</ol>
 
</ol>
 
<br>
 
<br>
Line 57: Line 57:
 
<li>Create a new folder called '''Data_Processing''' in the '''Module_02''' folder.
 
<li>Create a new folder called '''Data_Processing''' in the '''Module_02''' folder.
 
<li>Use the 'Import Empty File' tool to create a new 2d_zsh layer called ‘breaklines’ as a ‘line’ type. In the Spatial Database Options, select 'All to one'. Navigate to the '''Data_Processing''' folder and create a new GeoPackage database called '''M02_Breaklines.gpkg'''. Click Save and hit 'OK'.
 
<li>Use the 'Import Empty File' tool to create a new 2d_zsh layer called ‘breaklines’ as a ‘line’ type. In the Spatial Database Options, select 'All to one'. Navigate to the '''Data_Processing''' folder and create a new GeoPackage database called '''M02_Breaklines.gpkg'''. Click Save and hit 'OK'.
<li>Digitise a line using the ‘Add Line Feature’ button following the road crest. This could match the provided breaklines or be an section of road not covered by the original breakline.  
+
<li>Digitise a line using the ‘Add Line Feature’ button following the road crest. This could match the provided breaklines or be a section of road not covered by the original breakline.  
 
<li>Enter the following attributes and save the file:
 
<li>Enter the following attributes and save the file:
 +
*fid: Autogenerate
 
*Z: Null
 
*Z: Null
 
*dZ: 30
 
*dZ: 30
 
*Shape_Width: 5
 
*Shape_Width: 5
 
*Shape_Option: Max
 
*Shape_Option: Max
<li>Close the layer in QGIS (right click on it from the Layers panel and select 'Remove Layer'). Cut and paste all of the '''2d_zsh_breaklines_L''' files from '''M02_001.gpkg''' into '''M02_Breaklines.gpkg'''.
 
 
<li>Create a new batch file '''_run_M02_asc_to_asc_Breaklines.bat''' in the '''Module_02\Data_Processing''' folder and open it in a text editor.
 
<li>Create a new batch file '''_run_M02_asc_to_asc_Breaklines.bat''' in the '''Module_02\Data_Processing''' folder and open it in a text editor.
 
<li>Input the following (Note: Utility location may differ): <br>  
 
<li>Input the following (Note: Utility location may differ): <br>  
<font color="blue"><tt>'''set''' </tt></font> <font color="black"><tt>asc_to_asc</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\..\exe\asc_to_asc.2023-03-AA\asc_to_asc_w64.exe"</tt></font> <br>
+
<font color="blue"><tt>'''set''' </tt></font> <font color="black"><tt>asc_to_asc</tt></font><font color="red"><tt>=</tt></font><font color="black"><tt>"..\..\exe\asc_to_asc.2023-03-AA\asc_to_asc_w64.exe"</tt></font> <br>
 
<li>Use the -brkline flag to call the breakline function. The utility then expects the 2d_zsh_breaklines layer and the DEM.<br>
 
<li>Use the -brkline flag to call the breakline function. The utility then expects the 2d_zsh_breaklines layer and the DEM.<br>
 
<font color="orange"><tt>%asc_to_asc% </tt></font> <font color="black"><tt>-brkline "M02_Breaklines.gpkg >> 2d_zsh_breaklines_L" ..\TUFLOW\model\grid\DEM.tif</tt></font> <br>
 
<font color="orange"><tt>%asc_to_asc% </tt></font> <font color="black"><tt>-brkline "M02_Breaklines.gpkg >> 2d_zsh_breaklines_L" ..\TUFLOW\model\grid\DEM.tif</tt></font> <br>
 
<li>Save the batch file and double click it in file explorer to run the utility.
 
<li>Save the batch file and double click it in file explorer to run the utility.
<li>The utility creates a points layer and updates the lines layer. These layers can be copied into '''M02_001.gpkg''' and read into the TGC.
+
<li>The utility creates a new '''M02_Breaklines_brkline.gpkg''' that contains a points layer and updates the lines layer. These layers can be copied into '''M02_001.gpkg''' and read into the TGC.
 
</ol>
 
</ol>
 
<br>
 
<br>

Latest revision as of 10:10, 23 September 2024

Introduction

QGIS is used to create, import and view input data.

TUFLOW Project Re-Configuration

Re-configure the TUFLOW project to use and save empty files to the correct folder:

  1. Go to Plugins > TUFLOW > Editing > Configure / Create TUFLOW Project.
  2. Change the folder which contains TUFLOW to the Module_02 folder. This is the only change required, the model folder structure and template empty files are supplied from previous model.
    Note: The 'results' and 'check' folder get automatically created when the TUFLOW model is run.
  3. Click 'OK' and save the QGIS workspace by selecting Project > Save As.

    M02 GPKG ConfigureProject.PNG

  4. Set the QGIS workspace projection to EPSG:32760, see Set the Projection.


Method

Set up the GeoPackage Database:

  1. Navigate to the Module_02\TUFLOW\model\gis folder. Save a copy of M01_001.gpkg as M02_001.gpkg.
  2. Within the QGIS Browser Panel, right click on 'Favorites' and select 'Add a Directory...'.
  3. Navigate to the Module_02 folder and select it.

Within the QGIS Browser Panel, navigate to the Module_02\Tutorial_Data folder. Drag and drop the following layers into the M02_001.gpkg:

  • 2d_zsh_M02_rd_crest_001_L
  • 2d_zsh_M02_rd_crest_001_P



Investigate the supplied files:

  1. Open the files, either:
    • Within the QGIS Browser Panel, navigate to M02_001.gpkg and double click the layers, or
    • In File Explorer, drag and drop the M02_001.gpkg into the QGIS workspace and select the layers (hold Ctrl to select multiple).
  2. The 2d_zsh line layer represents the breaklines:
    • No ‘Z’ attribute is specified, the elevations are taken from the 2d_zsh point layer.
    • The breakline on the north side has the same Shape_Width as the cell size, this is a thick breakline modifying whole cells. The other two breaklines don't have the attribute specified, these are thin breaklines modifying only the cell sides and cell corners.
    • The Shape_Option of 'MAX' is specified for all breaklines. The Zpt elevations only changes when the Z shape elevation at the Zpt is higher. The purpose of the Z shape is to enforce the highest elevations along the road crest.



  3. The 2d_zsh point layer is used to apply elevation to the breaklines:
    • The values in the 'Z' attribute are elevations above datum assigned to each point. The elevations are being interpolated along the breakline.
    • The points must be snapped to the vertices of the 2d_zsh line to instruct TUFLOW that these layers are linked. 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. For more information, refer to the TUFLOW Manual.



Creating Breaklines (Optional)

Breaklines are provided for this tutorial, however, these could be made using the breakline flag with the asc_to_asc utility which extracts elevations from a DEM for breaklines in the 2d_zsh format. The utility is provided in the exe/asc_to_asc folder. It can also be downloaded from the TUFLOW website and saved into a folder with other utilities.

  1. Create a new folder called Data_Processing in the Module_02 folder.
  2. Use the 'Import Empty File' tool to create a new 2d_zsh layer called ‘breaklines’ as a ‘line’ type. In the Spatial Database Options, select 'All to one'. Navigate to the Data_Processing folder and create a new GeoPackage database called M02_Breaklines.gpkg. Click Save and hit 'OK'.
  3. Digitise a line using the ‘Add Line Feature’ button following the road crest. This could match the provided breaklines or be a section of road not covered by the original breakline.
  4. Enter the following attributes and save the file:
    • fid: Autogenerate
    • Z: Null
    • dZ: 30
    • Shape_Width: 5
    • Shape_Option: Max
  5. Create a new batch file _run_M02_asc_to_asc_Breaklines.bat in the Module_02\Data_Processing folder and open it in a text editor.
  6. Input the following (Note: Utility location may differ):
    set asc_to_asc="..\..\exe\asc_to_asc.2023-03-AA\asc_to_asc_w64.exe"
  7. Use the -brkline flag to call the breakline function. The utility then expects the 2d_zsh_breaklines layer and the DEM.
    %asc_to_asc% -brkline "M02_Breaklines.gpkg >> 2d_zsh_breaklines_L" ..\TUFLOW\model\grid\DEM.tif
  8. Save the batch file and double click it in file explorer to run the utility.
  9. The utility creates a new M02_Breaklines_brkline.gpkg that contains a points layer and updates the lines layer. These layers can be copied into M02_001.gpkg and read into the TGC.


Conclusion

  • Two 2d_zsh layers were inspected to enforce the breaklines in the model.


Up
Go-up.png Back to Module 2 Main Page