GeoPackage Tips: Difference between revisions

Content deleted Content added
Line 8:
 
= Database Organisation =
There are many ways to organise model inputs when using GeoPackagesGPKG. This allows modellers to decide how they structure their inputs files, for example some options include:
*aA single database for an entire project,
*separateSeparate database for an existing or developed case, or
*separateSeparate databases for each type of input (e.g. elevation, materials, culverts).
 
== Referencing a GeoPackage Database ==
To reference a GeoPackageGPKG Database:
<ol>
<li>To specify a GeoPackageGPKG Database for the entire model, add the following command to the beginning of the .tcf. This database will then be the default for all inputs in all control files. There is no need to reference the database again in the other control files. <br>
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt> <path_to_database> </tt>
<li>To specify a different GeoPackageGPKG Database for subsequent inputs, use the following command. A new database can be specified multiple times throughout control files, TUFLOW will change which database it looks to based on the last time the above command has been referenced. This command can be used in the .tcf, .ecf, .tbc, .tgc, .qcf, .tef. For example:<br>
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh.gpkg </tt> <font color="green"><tt> ! Sets GeoPackageGPKG Database</tt></font> <br>
<font color="black"><font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_zsh_existing_L </tt></font> <font color="green"><tt> ! References the 2d_zsh_L layer from 2d_zsh.gpkg</tt></font> <br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_zsh_development_L </tt></font> <font color="green"><tt> ! References the 2d_zsh_L layer from 2d_zsh.gpkg</tt></font> <br><br>
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_mat.gpkg </tt></font> <font color="green"><tt> ! Sets GeoPackageGPKG Database</tt></font> <br>
<font color="blue"><tt>Read GIS Mat </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_mat_existing_R </tt></font> <font color="green"><tt> ! References the 2d_mat_R layer from 2d_mat.gpkg</tt></font> <br>
<font color="blue"><tt>Read GIS Mat </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_mat_development_R </tt></font> <font color="green"><tt> ! References the 2d_mat_R layer from 2d_mat.gpkg</tt></font> <br>
Line 29:
==Referencing a GeoPackage Layer==
 
There are many ways to reference a GeoPackageGPKG Layer. The following commands can be used in the .tcf, .ecf, .tbc, .tgc, .qcf and .tef. <br>
<ol>
<li>To specify a table in a .gpkgGPKG, 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 "&&". This is similar to "|", however there is no need to reference the database again. <br>
Line 37:
<li>"&&" can be used in conjunction with "|":<br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_R.gpkg | gis\2d_zsh.gpkg >> 2d_zsh_L && 2s_zsh_P </tt><br>
<li>To specify a .gpkgGPKG file path only. It will assume the table name is the same as the .gpkgGPKG database name. The following are equivalent:<br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_L.gpkg </tt><br>
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh_L.gpkg >> 2d_zsh_L </tt><br>
<li>To specify all the tables in a .gpkgGPKG, use the command "USE ALL" with ">>":<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 >> USE ALL </tt><br>
<br>
</ol>
 
If the GeoPackageGPKG Database is specified to use for subsequent inputs, the commands will become:<br>
<font color="blue"><tt>Spatial Database </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>gis\2d_zsh.gpkg </tt> <font color="green"><tt> ! Sets GeoPackageGPKG Database</tt></font> <br>
<ol>
<li>To specify a table:<br>
Line 54:
<font color="blue"><tt>Read GIS Z Shape </tt></font> <font color="red"><tt>== </tt></font> <font color="black"><tt>2d_zsh_L && 2d_zsh_P </tt><br>
</ol>
Note: If the .gpkgGPKG for the model is referenced in the .tcf (using the 'Spatial Database' command), it does not need to be referenced again in the other control files. However, if the model inputs are not contained in a single .gpkgGPKG, the separate databases must be referenced accordingly.
 
== Outputs ==
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 GeoPackageGPKG 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 a TUFLOW 'Check' folder from a model using the GeoPackageGPKG (grouped). The same 'Check' folder for a model using Shapefile would have 44(!) items in it. <br><br>
{{Video|name=GPKG Tips CheckFiles.mp4|width=1000}}<br>