Difference between revisions of "QGIS TUFLOW Styles"

From Tuflow
Jump to navigation Jump to search
Line 1: Line 1:
 
=Introduction=
 
=Introduction=
When outputting GIS files in the shapefile format, no styling information is (or can be included).  For example when viewing a [[Check_Files_2d_zsh_zpt | _zsh_zpt_check_P]], the user may wish to view whether the zpt (elevation point) has been raised, lowered, or no change has been applied.  This GIS layer contains an attribute '''dz''' and the symbology options can be used to achieve this. For instructions to do this manually, please see [[QGIS_Thematic_Mapping | QGIS Symbology]].<br>
+
When outputting GIS files in the shapefile format, no styling information is (or can be included).  For example when viewing a [[Check_Files_2d_zsh_zpt | _zsh_zpt_check_P]], the user may wish to view whether the zpt (elevation point) has been raised, lowered, or no change has been applied.  This GIS layer contains an attribute '''dz''' and the symbology options can be used to achieve this. This can be done manually, or the TUFLOW plugin comes packaged with preset styles for almost every TUFOW check file and input type. The methods for applying the default TUFLOW template styling to layers are outlined below.<Br>  
The QGIS TUFLOW plugin also includes template styles for the majority of the check files. These are stored in a '''QGIS_Styles''' folder under the installation directory.  This directory is typically:<br>
+
===Apply TUFLOW Style to Current Layer===
<pre>C:\Users\<username>\.qgis2\python\plugins\TUFLOW\QGIS_Styles\</pre>
 
Where <username> is the Windows user name.<br>
 
<br>
 
For instructions on customising these styles please see [[Overwriting_Style_Templates | Overwriting Style Templates] below.<br>
 
There are currently three tools available for applying a TUFLOW style / symbology based on the templates, these are described further below.
 
=Apply TUFLOW Style to Current Layer=
 
 
As the name implies, this will apply the symbology to the current layer in the layer control.  If no template file exists for the layer type no change is made.<br>
 
As the name implies, this will apply the symbology to the current layer in the layer control.  If no template file exists for the layer type no change is made.<br>
 
This tool has a button in the toolbar which looks like the below:<br>
 
This tool has a button in the toolbar which looks like the below:<br>
Line 13: Line 7:
 
<br>
 
<br>
 
This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Current Layer menu item.<br>
 
This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Current Layer menu item.<br>
 
+
===Apply TUFLOW Styles to Open Layers===
=Apply TUFLOW Styles to Open Layers=
 
 
As the name implies, this will apply the symbology to all open layers in the layer control (even if the visibility is turned off).  This is particularly useful if loading in the .qgs project file from TUFLOW as this loads all of the input and output GIS files for the simulation, after loading if this tool is applied all output files will have a symbology applied.
 
As the name implies, this will apply the symbology to all open layers in the layer control (even if the visibility is turned off).  This is particularly useful if loading in the .qgs project file from TUFLOW as this loads all of the input and output GIS files for the simulation, after loading if this tool is applied all output files will have a symbology applied.
 
If no template file exists for a layer type no change is made.<br>
 
If no template file exists for a layer type no change is made.<br>
Line 22: Line 15:
 
This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Open Layers.<br>
 
This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Open Layers.<br>
 
<br>
 
<br>
An example QGIS map window showing the layers after this tool has been applied on a loaded .qgs project file is shown below.<br>
+
===Overwriting Style Templates===
[[File:QGIS TUFLOW CheckFile Symbology Open 02.png]]
+
A lot of the default styles are pulled from a database of .qml files located within the TUFLOW plugin installation directory. To overwrite any given style, the user just needs to save over an existing .qml file with their preferred styling. The .qml files are named to match the name of the file they will be applied to e.g. "1d_wll.qml" for an input 1D_WLL file and "_dom_check_R.qml" for a Domain check file. It's usually possible for the user to also create a new .qml if one doesn't already exist as long as it follows the same naming convention as the other .qml files and matches a TUFLOW type.<Br><br>
 
+
The location of the .qml files:<Br>
=Load Check Files and Apply Styles=
+
'''Windows'''<Br>
This tool has a button in the toolbar which looks like the below:<br>
+
<pre>%appdata%\QGIS\QGIS3\profiles\default\python\plugins\tuflow\QGIS_Styles</pre><Br>
[[File:Check files folder.png]]<br>
+
'''Linux'''<br>
This can also be accessed from the the Plugins >> TUFLOW >> Import Check Files from Folder.<br>
+
<pre>/home/USER/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/QGIS_Styles</pre><br>
Once the tool has been started, a dialogue as per the image below will be created.<br>
 
[[File:QGIS TUFLOW Import Check from folder.png]]<br>
 
<br>
 
The components of the dialogue are:<br>
 
<ol>
 
<li>Browse to folder containing check files.</li>
 
<li>Check file directory to import files from, can be set using the button above, or the folder location can be copied into this line.</li>
 
<li>Run ID. This is used to filter the check files to only a single simulation.</li>
 
<li>
 
</ol>
 
Once OK has been selected, the tool will open the files filtered using the '''RunID''' and apply the relevant symbology, an output is shown below.<br>
 
 
 
[[File:QGIS TUFLOW Import Check from folder 02.png]]
 
=Overwriting Style Templates=
 
When running these tools above, the following steps are performed:
 
* The names of all the .qml style files are loaded in from the '''QGIS_Styles''' folder under the installation directory.
 
* These files are sorted based on longest filename 1st.  For example the tool will search for '''_zsh_zpt_check_P''' before '''_zpt_check_P'''.
 
* For each layer (depending on the method above), the utility check if the style layer name is in the layer name.  For example if '''_zsh_zpt_check_P''' is found in the layer name '''M04_5m_001_zpt_check_P''', the layer will get this styling applied.
 
The logic above has been designed to allow the user to modify the symbology for a selected layer or add symbology for an additional layer.  This can be done by creating a custom symbology in the QGIS Styles dialogue.  Once the preferred symbology has been created, the '''Style >>> Save Style >> QGIS Layer Style File''' can be used to save this as a QGIS .qml file.  These steps are outlined in the image below.<br>
 
<br>
 
[[File:QGIS TUFLOW CheckFile Custom Symbology 01.png]]<br>
 
 
<br>
 
<br>
This .qml file can be saved in the QGIS_Style folder, for example to overwrite the _zsh_zpt_check_P.qml symbology, this file would be saved as per the below.<br>
 
[[File:QGIS TUFLOW CheckFile Custom Symbology 02.png]]<br>
 
This same process could be used to add additional functionality, for example no _hydroprop_check_L template is provided, but one could be created to style this based on one of the attributes in the GIS layer (such as Channel type, Manning's n, conveyance etc.)
 
 
 
<br>
 
<br>
 
{{Tips Navigation
 
{{Tips Navigation
 
|uplink=[[TUFLOW_QGIS_Plugin#Usage| Back to TUFLOW QGIS Plugin Main Page]]
 
|uplink=[[TUFLOW_QGIS_Plugin#Usage| Back to TUFLOW QGIS Plugin Main Page]]
 
}}
 
}}

Revision as of 00:08, 6 April 2022

Introduction

When outputting GIS files in the shapefile format, no styling information is (or can be included). For example when viewing a _zsh_zpt_check_P, the user may wish to view whether the zpt (elevation point) has been raised, lowered, or no change has been applied. This GIS layer contains an attribute dz and the symbology options can be used to achieve this. This can be done manually, or the TUFLOW plugin comes packaged with preset styles for almost every TUFOW check file and input type. The methods for applying the default TUFLOW template styling to layers are outlined below.

Apply TUFLOW Style to Current Layer

As the name implies, this will apply the symbology to the current layer in the layer control. If no template file exists for the layer type no change is made.
This tool has a button in the toolbar which looks like the below:
Check files currentlayer.png
This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Current Layer menu item.

Apply TUFLOW Styles to Open Layers

As the name implies, this will apply the symbology to all open layers in the layer control (even if the visibility is turned off). This is particularly useful if loading in the .qgs project file from TUFLOW as this loads all of the input and output GIS files for the simulation, after loading if this tool is applied all output files will have a symbology applied. If no template file exists for a layer type no change is made.
This tool has a button in the toolbar which looks like the below:
Check files open.png

This can also be accessed from the the Plugins >> TUFLOW >> Apply TUFLOW Styles to Open Layers.

Overwriting Style Templates

A lot of the default styles are pulled from a database of .qml files located within the TUFLOW plugin installation directory. To overwrite any given style, the user just needs to save over an existing .qml file with their preferred styling. The .qml files are named to match the name of the file they will be applied to e.g. "1d_wll.qml" for an input 1D_WLL file and "_dom_check_R.qml" for a Domain check file. It's usually possible for the user to also create a new .qml if one doesn't already exist as long as it follows the same naming convention as the other .qml files and matches a TUFLOW type.

The location of the .qml files:
Windows

%appdata%\QGIS\QGIS3\profiles\default\python\plugins\tuflow\QGIS_Styles


Linux

/home/USER/.local/share/QGIS/QGIS3/profiles/default/python/plugins/tuflow/QGIS_Styles




Up
Go-up.png Back to TUFLOW QGIS Plugin Main Page