TUFLOW Setup with Kart QGIS Plugin: Difference between revisions
Content deleted Content added
Tuflowduncan (talk | contribs) No edit summary |
Tuflowduncan (talk | contribs) |
||
| (8 intermediate revisions by 2 users not shown) | |||
Line 10:
All of these are useful from a quality assurance perspective, allowing a history of the development of a TUFLOW model geometry files to be understood and analysed. Kart is very easy to use once it is set up. The set up of Kart to be used with TUFLOW is a little cumbersome but the steps below provide information of how to set up the Kart QGIS Plugin, set up the TUFLOW folders and initialise the Kart repository.
==
The first step is to install the Kart QGIS plugin. This is done using the '''Manage and Install Plugins''' tool within QGIS. Search for Kart and install the plugin.
[[File:Kart QGIS Plugin.png|thumb|600x600px|Kart QGIS Plugin|alt=|none]]The plugin requires that you install Kart from https://kartproject.org/
Once the plugin and Kart is installed, there is a Kart menu within QGIS with some settings. Specify the path to the installed Kart executable. There's an option to Auto Commit which will commit your changes to the repository when you 'Toggle editing' off within QGIS. This can be a useful option, although the drawback is that you are not prompted to add a commit message.[[File:Kart Settings.png|thumb|Kart Settings|alt=|none|465x465px]]
The Kart Repositories panel should show something similar to the following, with no repositories showing.
[[File:Kart Repository.png|thumb|Initial Kart Repository|alt=|none|465x465px]]
==
With Kart set up, we can now move towards setting up your TUFLOW model. To use Kart, you would need to be using a Geopackage GIS Format. We will start at the beginning of a TUFLOW model build but it would be possible to set up kart with an existing model with a similar workflow.
Firstly, we'll set up our TUFLOW folder structure and template files. To set up your TUFLOW folders, you can use your chosen method of either the [[QGIS TUFLOW Create Project|TUFLOW Create Project]] tool or the [[Create TUFLOW Project]] tool.
With the TUFLOW folders set up, there is now some fiddly steps to go through so that we can set up a Kart repository. This is because a Kart
[[File:GIS Folder.png|none|thumb|390x390px|The Desired TUFLOW GIS Folder Initialised as a Kart Repository|alt=]]
Kart probably works best with a single Geopackage for the whole TUFLOW model, although it would be possible to use with seperate Geopackages. The steps below are for a single Geopackage.
* Cut and paste the '''empty''' folder and the model Geopackage file from the '''TUFLOW\Model\GIS''' folder to TUFLOW\Model. This is because Kart can not initialise a repository if the folder is not empty.
* Rename the '
* Use the Kart Create new repository tool to create a new Kart repository.
[[File:Create Kart Repository.png|thumb|Create Kart Repository|alt=|none|400x400px]]
* Select the '''TUFLOW\Model\Model_Name''' folder and ensure 'Geopackage in repository folder' is selected in the Storage type option. Click OK.
[[File:Kart Repository Setup.png|alt=Kart Repository Setup|thumb|none|400x400px]]
* Cut and paste the ''''empty'''<nowiki/>' folder from '''TUFLOW\Model''' to the '''TUFLOW\Model\Model_Name''' folder.
* Rename the ''''Model_Name'''<nowiki/>' folder to ''''GIS'''<nowiki/>'
Line 41 ⟶ 45:
* We will now remap the <nowiki/>repository to th<nowiki/>e '''GIS''' folder. In the Kart repositories panel, highlight the current repositiry and choose to 'remove this repository'. Click Yes when the prompt dialogue comes up.
[[File:Remove Repository.png|thumb|Remove Repository|alt=|none|400x400px]]
* We now need to add the renamed folder as an existing repository. Right click on the repositories option and select 'Add existing repository'. Navigate to the '''TUFLOW\Model\GIS''' folder and choose select folder.
[[File:Add Existing Respository.png|thumb|Add Existing Repository|alt=|none|400x400px]]
* We can now import the '''Model_Name.gpkg''' into the repository. This is done by right clicking on the repository and selecting 'Import dataset from file'. Navigate to the '''TUFLOW\Model\Model_Name.gpkg''' and select open.
[[File:Import dataset from File.png|thumb|Import Dataset from File|alt=|none|400x400px]]
* The repository will now show the Geopackage layers, which at present is only the projection layer generate during the create TUFLOW project step.
[[File:Repository.png|thumb|Repository after Importing the Geopackage Dataset|alt=|none|400x400px]]
* Finally, the Model_Name.gpkg can be deleted from the '''TUFLOW\Model''' folder.
Line 60 ⟶ 64:
== TUFLOW Model Build ==
We can now start to build our TUFLOW model using the traditional steps of the [[QGIS TUFLOW Import Empty|Import Empty File]] tool within the QGIS TUFLOW Plugin. When importing the empty files, we can import to the gpkg in Kart repository using the options in the following image, ensuring to select the 'All to one' option and choosing to 'Import into Kart repo folder'.
[[File:Import Empty File.png|thumb|Import Empty File|alt=|none|452x452px]]
Once the empty file is imported, you can refresh the Kart Repository, and see the additional layers with there.
[[File:Kart Repository 2.png|thumb|Kart Respository Showing the Imported Empty File|alt=|none|400x400px]]
We can now build the TUFLOW model geometry as we would do usually. As we add additional layers to the geodatabase, they will start to appear in the Kart repositories panel.
If the option to 'Commit automatically after closing editing' then the changes will be automatically committed. This is useful to avoid forgetting to commit, similar to how an autosave can be beneficial. Alternatively, it is possible to commit manually, either by clicking the repository or the individual layers and using the 'Commit working copy changes' or 'Commit working copy changes for this dataset' option respectively. The benefit of the latter approach is that there are less frequent commits and the user is prompted for a commit message prior to committing the working changes.
[[File:Commit message.png|none
If you select the Kart repository or an individual layer dataset then you can choose to 'Show log' which provides a table of the commit history.
[[File:Commit History.png|none|frame|Kart Layer Dataset Commit History]]
Line 74 ⟶ 78:
== Using Remote Repositories ==
The above steps are for a local Kart repository. However, it is possible to use Kart with remote repositories. This
This can be done by cloning a remote respository on Gitlab/Github or similar or pushing the local repository to Gitlab/Github or similar.
To do push a local repository to Gitlab or Github, firstly create the remote repository in Gitlab/Github. Don’t initialise the project with a readme file as this can cause issues. Once set up, got to the Kart plugin within QGIS, navigate to the local repository you would like to upload and right click on the repository and choose to ‘push’ changes.
[[File:Kart Push.png|none|thumb|400x400px]]
Choose to ‘Manage remotes’. Within the resulting dialogue, add the remote name and URL. It is recommended to use SSH Keys for authentication. When using SSH keys the form of the url would be git@gitlab.com: 'username' 'git repository.git' where username would be your own Gitlab user name and the git repository would be the remote repository ID.
[[File:Kart Manage Remotes.png|none|thumb|400x400px]]
Choose Add New/Save to save the options. In the next dialogue, select OK. If the permissions are set up correctly, the repository should be pushed to the remote repository and a message will pop up within QGIS indicating success.
An example of the TUFLOW Tutorial Geopackage dataset from modules 1 and 2, is available from the [https://gitlab.com/tuflow-user-group TUFLOW Gitlab User Group] at following location: https://gitlab.com/tuflow-user-group/third-party-tools/other/tuflow_tutorial_model_kart.
This can be cloned using Kart by selecting Clone Repository.
[[File:Kart CLone.png|none|thumb|400x400px]]
If using SSH keys the URL for the repository would be: git@gitlab.com: tuflow-user-group/third-party-tools/other/tuflow_tutorial_model_kart.git. Choose a suitable location to save the repository locally.
[[File:Kart CLone 2.png|none|thumb|400x400px]]
The repository will then appear within Kart in the list of repositories and can be interrogated with the above tools. A remote repository can also allow multi-user editing, providing the opportunity for conflicts which can be dealt with. See the [https://docs.kartproject.org/en/latest/ Kart documentation] for more details.
{{Tips Navigation
| |||