QGIS Create a TIN: Difference between revisions

Content deleted Content added
 
(7 intermediate revisions by the same user not shown)
Line 1:
<span style="color:#FF0000">
<font size = 18>Page Under Construction</font>
</span>
 
=Introduction=
TUFLOW offers powerful tools for modifying a model's geometry, including generating Triangulated Irregular Networks (TINs) from input data. Alternatively, TINsusers can becreate createdTINs in QGIS andbefore importing importedthem into TUFLOW. The advantage of this approach is that it allows the user to visualise and review the TINs before they are included in the model.
 
ThisTo exampledemonstrate usesthe workflow, the DEM and GIS files (in GeoPackage format) from <u>[[Tutorial_M02#Part_2_-_Other_Topographic_Updates|Tutorial Module 2 (part 2)]]</u> are used as examples. The instructions below refer to the GeoPackage format, but Shapefile format is also supported.
 
To create a TIN in QGIS, the following files are needed:
* A DEM (raster) layer.
* 2d_zsh (Z shape) layers that define topological modifications:
:* A polygon layer (e.g. '''2d_zsh_M02_landscape_002_R''')
:* At least one points layer containing elevation data (e.g. '''2d_zsh_M02_landscape_002_P'''). These points should not be snapped to the polygon.
:* At least one breaklines layer (e.g. '''2d_zsh_M02_landscape_002_L''')
:: If multiple, repeat the <u>[[QGIS_Create_a_TIN#Extract_Elevation_of_Breakline_Vertices_From_IDW_Interpolation | Extract Elevation of Breakline Vertices]]</u> process for each layer. Then, include all outputs in the <u>[[QGIS_Create_a_TIN#Create_TIN_Mesh | Create TIN Mesh]]</u> process.
'''Note:''' All features in the points and breaklines layers must be within the polygon extent.
<br>
 
=Method=
==Densify Merge Polygon Vertices==
Densify the merge polygon vertices using the QGIS processing tool 'Densify by Interval'. For more information about this tool, please refer to the <u>[https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#densify-by-interval QGIS Documentation - Densify by Interval]</u>.
<ol>
<li>In QGIS, open the merge polygon layer (e.g. '''TUFLOW\model\gis\2d_zsh_M02_landscape_002_R''').<br>
<li>Go to Processing > Toolbox from the top dropdown menu options to open the Processing Toolbox.<br>
<br>
Line 18 ⟶ 24:
<br>
<li>Go to 'Vector geometry' in the processing tool list and select 'Densify by interval'. This opens the dialog shown below:
*Input layer: Select the merge polygon (e.g. '''2d_zsh_M02_landscape_002_R''').
*Interval between vertices to add: This value should be set to the smaller of the following two values - half the model cell size, or the finest quadtreeQuadtree level.
*Densified: Leave as default.
*Tick on 'Open output file after running algorithm'.
Line 26 ⟶ 32:
[[File: QGIS_Create_TIN_Densify_Polygon_01.png]]<br>
<br>
<li>The resulting layer, called '''Densified''' will appear in the QGIS Layers panel. This is a copy of the merge polygon, now updated with additional vertices based on the specified interval.
<li>In the QGIS Layers panel, right click '''Densified''' and select 'Rename Layer'. Rename the layer to '''Densified_Polygon'''.<br>
'''Note:''' To see the vertices, toggle on editing for '''Densified_Polygon''' and select the 'Vertex Tool' [[File: vertex_tool_icon.png|40px]] from the Digitizing toolbar. Hover over the polygon to see the vertices.<br>
Line 37 ⟶ 43:
Extract elevation at polygon vertices from DEM using the QGIS processing tool 'Drape (set Z value from raster)'. For more information about this tool, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#drape-set-z-value-from-raster QGIS Documentation - Drape]</u>.
<ol>
<li> In QGIS, open the DEM file (e.g. '''TUFLOW\model\grid\DEM.tif''').
<li>Go to 'Vector geometry' in the Processing Toolbox panel and select 'Drape (set Z value from raster)'. This opens the dialog shown below:
*Input layer: '''Densified_Polygon'''
Line 50 ⟶ 56:
 
==Generate IDW Interpolation==
Generate a IDW (Inverse Distance Weighted) interpolation of the Z shape points layer (points layer containing elevation data), using the QGIS processing tool 'IDW Interpolation'. For more information about this tool, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/interpolation.html#qgisidwinterpolation QGIS Documentation - IDW Interpolation]</u>.
<ol>
<li> In QGIS, load all Z shape pointpoints layers within the merge polygon extent (e.g. '''TUFLOW\model\gis\2d_zsh_M02_landscape_002_P''').
<li>Go to 'Interpolation' in the processing tool list and select 'IDW Interpolation'. This opens the dialog shown below:
*Vector layer: Select the Z shape points layer (e.g. '''2d_zsh_M02_landscape_002_P''').
*Interpolation attribute: Select '''Z'''. This is the attribute that contains elevation data.
*Click [[File: QGIS_3D_Animation_add_keyframe_button_01.png|30px]] to add the vector layer to the table.
*RepeatIf available, repeat the above three points for allany other Z shape points layers within the merge polygon extent.
*Distance coefficient P: Leave as default.
*Extent: Click down arrow [[File: interpolation_extent_icon.png|40]] and select 'Calculate from Layer' >> 'Draped_Polygon'.
Line 75 ⟶ 81:
Extract elevation at breakline vertices from '''Interpolated''' using the QGIS processing tool 'Drape (set Z value from raster)'. For more information about this tool, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#drape-set-z-value-from-raster QGIS Documentation - Drape]</u>.
<ol>
<li> In QGIS, load the breaklines layer (e.g. '''TUFLOW\model\gis\2d_zsh_M02_landscape_002_L''').
<li>Go to 'Vector geometry' in the Processing Toolbox panel and select 'Drape (set Z value from raster)'. This opens the dialog shown below:
*Input layer: Select the breaklines layer (e.g. '''2d_zsh_M02_landscape_002_L''').
Line 88 ⟶ 94:
 
==Create TIN Mesh==
Create a TIN Mesh using the QGIS processing tool 'TIN Mesh Creation'. This tool will generate a TIN mesh from the above outputs and any elevationZ shape points thatlayers are(points notlayers snappedcontaining to the mergeelevation polygondata). For more information about this tool, please refer to <u>[https://docs.qgis.org/3.34/en/docs/user_manual/processing_algs/qgis/mesh.html#tin-mesh-creation QGIS Documentation - TIN Mesh Creation]</u>.
<ol>
<li>Go to 'Mesh' in the Processing Toolbox panel and select 'TIN Mesh Creation'. This opens the dialog shown below:
Line 95 ⟶ 101:
*Click [[File: QGIS_3D_Animation_add_keyframe_button_01.png|30px]] to add the vector layer to the table.
*Repeat the above three points for '''Draped_Polygon'''.
:*If there are any Z shape points layers within the merge polygon's extent but not snapped to the polygon, add these as well. For 'Value on Vertex', select the field that contains the elevation data (e.g. '''Z''').
*Output format: 2DM
*Output coordinate system: Use the project CRS.
Line 114 ⟶ 120:
The TUFLOW Geometry Control File (.tgc) must be updated to reference the TIN Mesh, which will replace any topography-modifying GIS layers (Z shapes) within the mesh extent.
 
Remove all references to Z shapes (<tt><font color="blue">Read GIS Z Shape</font><font color="red"> ==</font></tt> ) in the TGC file and replace them with: <tt><font color="blue">Read TIN Zpts</font><font color="red"> ==</font> grid\<TIN_Mesh_filename>.2dm | <merge_polygon_filenamepolygon_filename></tt>
:'''Note:''' The merge polygon is included in the command to ensure that the TIN is only applied within the extent of the merge polygon.
 
For example:<br>
<tt><font color="blue">Set Zpts </font><font color="red">==</font> 100 <font color="green"> ! Sets every 2D elevation zpt to 100 metres</font></tt><br>
<tt><font color="blue">Read GRID Zpts </font><font color="red">==</font> grid\DEM.tif <font color="green"> ! Assigns the elevation of zpts from the grid</font></tt><br>
<s><tt><font color="bluegreen">! Read GIS Z Shape </font><font color="red">==</font> 2d_zsh_M02_landscape_002_R | 2d_zsh_M02_landscape_002_L | 2d_zsh_M02_landscape_002_P <font color="green"> ! Defines areas of complex landscaping</font></tt></s><br>
<tt><font color="blue">Read TIN Zpts </font><font color="red">==</font> grid\TIN_Mesh.2dm | 2d_zsh_M02_landscape_002_R <font color="green"> ! Defines areas of complex landscaping</font></tt><br>