GeoPackage Tips: Difference between revisions

Content deleted Content added
 
(20 intermediate revisions by 3 users not shown)
Line 5:
*Supports spatial indexing, greatly reducing loading and viewing times, making it much faster to work within GIS packages.
*Faster to write from TUFLOW than the shapefile format.
For more information, seerefer to Section 4.4.3 of the <u>[https://wwwdocs.tuflow.com/downloads/tuflow-classichpcclassic-archivehpc/manual/latest/#2023 2023 ReleaseTUFLOW NotesManual]</u>.
 
= Database Organisation =
There are many ways to organise model inputs when using GPKG. This allows modellers to decide how they structure their inputs files, for example some options include:
*singleSingle database for an entire project
*separateSeparate database for each control file (e.g. geometry, boundary control file)
*separateSeparate database for an existing or developed case
*separateSeparate databases for each type of input (e.g. elevation, materials, culverts)
 
== Referencing a GeoPackage Database ==
Line 35:
<li>To specify a table in a GPKG, use ">>":<br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh.gpkg >> 2d_zsh_L </tt><br>
<li>To specify more than one table in a GPKG in the same command line, use "|". The database has to be referencereferenced for all the tables. <br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh.gpkg >> 2d_zsh_L | gis\2d_zsh.gpkg >> 2d_zsh_P </tt><br>
<li>To specify more than one table in a GPKG in the same command line, use "&&". This is similar to "|", however there is no need to reference the database again. <br>
Line 63:
Result and check file vector outputs can be written into separate databases or grouped, with 'grouped' being the default. Grouped databases will group by output folder location, for example, the check file folder will contain one GPKG Database that contains all check file layers within it. Separate databases will group geometries together, for example, PLOT_P, PLOT_L, PLOT_R will be written to one database. The following command can be used to set the output to either separate or grouped: <br>
<font color="blue"><tt>Spatial Database Output</tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>SEPARATE | {GROUPED} </tt></font> <br><br>
This is a huge benefit in terms of file organisation. The below shows athe TUFLOW 'Check' folder from a model using the GPKG (grouped) and a model using the GPKG separate. The same 'Check' folder for a model using Shapefile would have 44(!) items in it. <br><br>
*Grouped:
{{Video|name=GPKG Tips CheckFilesAnimation_Outputs_grouped.mp4|width=1000}}<br>
*Separate (grouped geometries):
{{Video|name=Animation_Outputs_separate.mp4|width=1000}}<br>
 
= QGIS Tips & Tricks =
Line 86 ⟶ 89:
</ol>
 
== Setting a BrowerBrowser Panel Favourite ==
For quick access, a project folder can be set as a favourite in the QGIS Browser Panel.
<ol>
Line 105 ⟶ 108:
<li>Move a layer from one GPKG to another.<br>
<br>
{{Video|name=browser_panel_move_layerbrowser_panel_move_layer_b.mp4|width=1000}}
<br>
<li>Move a shapefile into a GPKG. QGIS will automatically convertconverts it to a GPKG layer.<br>
<br>
{{Video|name=browser_panel_move_shpbrowser_panel_move_shp_a.mp4|width=1000}}
<br>
<li>Rename a layer in a GPKG.<br>
<br>
{{Video|name=Animation_rename_layerAnimation_rename_layer_a.mp4|width=1000}}
<br>
<li>Delete a layer in a GPKG.<br>
<br>
{{Video|name=Animation_delete_layer.mp4|width=1000}}
</ol>
<br>
 
== Create a New Layer ==
Use the TUFLOW plugin to create a new layer.
<ol>
<li>Click on the ‘Import Empty File’ symbol from the TUFLOW Plugin toolbar. <br>
<br>
[[File:import_empty_file.png]]<br>
<br>
<li>This opens the Dialog shown below. The TUFLOW plugin accesses the 'Empty Directory' created when the project was configured and provides a list of files to choose from. It appends the 'Empty Type' to the beginning of the 'RUN ID' and the 'Geometry Type' letter to the end. This becomes the name of the file.<br>
<br>
[[File:import_empty_dialogue.png]]<br>
<br>
<li>In the 'Spatial Database Options' section, there are the following options:
<ol>
<li>'''Convert to GPKG'''. This converts the imported format to a GPKG even if the empty file format is not a GPKG. The video below shows it being used for the 'Separate' option, however it can be toggled on for any of the export options. <br>
<br>
{{Video|name=Animation_import_layer_convert.mp4|width=1000}}
<br>
<li>'''Separate:''' Creates a separate GPKG for each new file.<br>
<br>
{{Video|name=Animation_import_layer_separate.mp4|width=1000}}
<br>
<li>'''Group geometry types:''' Creates a GPKG containing the new files for all selected geometry types.<br>
<br>
{{Video|name=Animation_import_layer_group_geom.mp4|width=1000}}
<br>
<li>'''All to one:''' Adds the new files to a new or existing GPKG.<br>
<br>
{{Video|name=Animation_import_layer_alltoone_preexisting.mp4|width=1000}}
<br>
<br>
{{Video|name=Animation_import_layer_alltoone_new.mp4|width=1000}}
<br>
</ol>
</ol>
For more information, see [[QGIS TUFLOW Import Empty|QGIS TUFLOW Import Empty]].
<br>
<br>
 
Line 120 ⟶ 165:
This TUFLOW Plugin tool saves a copy of the active layer with a new filename. To use the tool:
<ol>
<li>Select the layer to increment in the Layers Panelpanel.
<li>Click on the 'Increment Selected Layer' symbol from the TUFLOW Plugin toolbar.<br>
<br>
Line 128 ⟶ 173:
There are three options for incrementing a layer:
<ol>
<li>Increment layer only (default): This option will incrementincrements the filename and the GPKG database by 1. It will then closecloses the old layer and openopens the new one. For example, the tool increments '''M01_00''1''M01_001.gpkg''' to '''M01_00''2''M01_002.gpkg''' and '''2d_code_M01_00''1''_R2d_code_M01_001_R''' to '''2d_code_M01_00''2''_R2d_code_M01_002_R'''.
:*Note: In the video below, the output database is manually changed back to '''M01_00''1''M01_001.gpkg'''. If the default settings were not changed the new layer would have been added to a new GPKG, '''M01_00''2''M01_002.gpkg'''. <br>
<br>
{{Video|name=Animation_increment_layer_default.mp4|width=1000}}<br>
<li>Increment layer and preserve database: This option will incrementincrements the filename of the selected layer and the GPKG database by 1. It will also copycopies all other layers from the original GPKG database into the newincremented GPKG database. For example, the tool makes a copy of '''M01_00''1''M01_001.gpkg''' and increments it to '''M01_00''2''M01_002.gpkg'''. All layers are copied across with their original filename, except the selected layer, which is incremented to '''2d_code_M01_002_R'''.<br>
<br>
{{Video|name=Animation_increment_layer_preserve_db.mp4|width=1000}}<br>
<li>Save layer out into superseded folder: This option will incrementincrements the the filename of the selected layer by 1. It will then closecloses the old layer and openopens the new one. The old layer will begets moved into a new folder called 'ss'. For example, the tool increments '''2d_code_M01_00''1''_R2d_code_M01_001_R''' to '''2d_code_M01_00''2''_R2d_code_M01_002_R''' and moves '''2d_code_M01_00''1''_R2d_code_M01_001_R''' to the 'ss' folder. <br>
<br>
{{Video|name=Animation_increment_layer_ss.mp4|width=1000}}
<br>
</ol>
For more information, see the <u>[[QGIS_TUFLOW_Increment_Layer| Increment Layer Tool]].</u><br>
<br>
 
==Apply GeoPackage Layer Names ==
This tool will change the layer name (within the Layers Panelpanel) to be the same as the layer name within the GPKG database. To use the tool:
<ol>
<li>Drag and Drop the GPKG Database from Windows File Explorer to QGIS.
Line 150 ⟶ 196:
[[File: GPKG_layer_names_a.png]]<br>
<br>
{{Video|name=Animation_apply_GPKG_layer_namesAnimation_apply_GPKG_layer_names_a.mp4|width=1000}}<br>
</ol>
Note: If the layers are opened from within the QGIS Browser Panel, they will automatically be named the same as within the GPKG database.<br>
<br>
For more information, see the <u>[[QGIS_TUFLOW_Apply_GPKG_Layer_Names| Updating a GPKG Layer Name]]</u>
=Tutorials=
Free TUFLOW tutorials using the GeoPackage format are availble via: <u>[[Tutorial Introduction|TUFLOW HPC Tutorials]]</u>