TUFLOW Setup with Kart QGIS Plugin
Introduction
Kart is a version control tool which stores geospatial data (and tabular data) in Git, providing a neat version control system whilst building TUFLOW models. Despite using Git, there is no requirement for the user to have a thorough understanding of Git, it's processes and commands. The Kart QGIS plugin provides user interface for Kart which provides some tools for reviewing changes to the geospatial data. This page describes a workflow for setting up a TUFLOW project, utilising Kart, and provides some of the benefits of using the Kart tools for version control. Kart can be used with remote repositories to allow multiple users to access the data and work simultaneously with merge control, however, the example below is a local repository for the purposes of version control and ease of quality assurance checking.
Benefits of using Kart
The video below shows an initial model build with some a number of TUFLOW model layers and where the layer geometry has undergone a number of iterative changes. The video shows:
- The commit history table.
- Tags for specific commits. For instance for models that have undergone QA, been sent to a client or sent to support@tuflow.com.
- The evaluation in differences between commit versions both in text form and in geometry form.
Install the Kart Plugin
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.
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.
The Kart Repositories panel should show something similar to the following, with no repositories showing.
Set up the TUFLOW Model and Initialise Kart Repository
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. To set up your TUFLOW folders, you can use your chosen method of either the 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. 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 Empties folder and the 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 'GIS' folder to '*Model_Name*' where '*Model_Name*' is the same as your Geopackage name.
- Use the Kart Create new repository tool to create a new Kart repository.
- Select the TUFLOW\Model\Model_Name folder and ensure 'Geopackage in repository folder' is selected in the Storage type option. Click OK.
- Cut and paste the 'empty' folder from TUFLOW\Model to the TUFLOW\Model\Model_Name folder.
- Rename the 'Model_Name' folder to 'GIS'
- In the Kart repositories panel, highlight the current repositiry and choose to 'remove this repository'. Click Yes when the prompt dialogue comes up.
- We now need to add the renamed folder as an existing repository. Right click on the repositories optoin and select 'Add existing repository'. Navigate to the TUFLOW\Model\GIS folder and choose select folder.
- We need to 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.
- The repository will now show the Geopackage layers, which at present is the projection layer.
- Finally, the Model_Name.gpkg can be deleted from the TUFLOW\Model folder.
The above steps are by far and away the fiddliest steps with the TUFLOW model Kart set up. Now we can start building the TUFLOW model.
TUFLOW Model Build
We can now start to build our TUFLOW model using the traditional steps of the 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'.
Once the empty file is imported, you can refresh the Kart Repository, and see the additional layers with there.
We can now build the TUFLOW model geometry as we would do usually.
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 autosava 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'. The benefit of the latter approach is that there are less frequent commits and the user is prompted for a commit message.
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.
The commit history can then be interrogated to show the details of the commits, the differences between versions, adding tags and other git like tools such as branching, merging, reverting back to older versions as well as replacing working copy changes.It is also possible to apply spatial and temporal filters for changes. For a full list of Kart tools, the user is recommended to consult the Kart documentation here.
Using Remote Repositories
The above steps are for a local Kart repository. However, it is possible to use Kart with remote repositories. This is done by cloning a remote repository on Gitlab/Github or similar. Once a repository is cloned, changes can be push/pulled to and from the remote repository.
Up |
---|
![]() |