Template GDB Utility and Import/Export Tools¶
Introduction¶
This page describes utility tools included in the Template Geologic Map Databases toolbox. They are designed to help maintain and update the database output by the Database Creation Tools. The tools can be found under the 2. Utility Tools header.
For any utility tool that makes changes to data, The tool uses the GeMS Toolbox Compact and Backup tool to make a backup
of the database prior to making changes to it, thereby giving you an option to revert if the output is not what you expect.
No compacting is performed. The backup database is saved to the same directory as the original database, with a YYYY-MM-DD
datestamp suffix. A lower case letter starting with a is added to the end for subsequent backups done on the same day.
Utility Tools¶
Calculate GeMS Field Values¶
This tool will take a backup as described in the Introduction before making any changes.
This tool populates various GeMS fields throughout the database. It is particularly helpful when converting a non-GeMS database that does not have values for many GeMS fields. For all options selected, the tool uses a similar script, whereby it checks for applicable feature classes/tables that have at least one row of data and then makes updates. Fields that can be set include:
- SourceID fields such as DataSourceID, LocationSourceID, etc.
- PlotAtScale
- OrientationConfidenceDegrees
- MapUnit for point feature classes (excluding MapUnitLabelPoints and MapUnitPoints), by calculating the intersecting MapUnit or Units.
Each option above can be selected independently by checking the appropriate box and then providing the required information. Fields to enter values only appear if the appropriate checkbox is checked. Values are required only when applicable. Refer to the table below for an explanation of all parameters.
| Parameter | Explanation |
|---|---|
| Template Geologic Map Database | Path to the template gdb. This must be a geodatabase in the GeMS schema with a GeologicMap feature dataset and a DataSourceID domain. Provided that the database was generated by this toolbox, it will work with this tool. |
| Set SourceID Field Values | Check this box to set all SourceID values in the database to the same value. Note that the Glossary DefinitionSourceID values are not updated by this tool. |
| SourceID Attribute Value | This field includes values from the DataSourceID domain. Select the value to use for all SourceID fields in the database. Note that the Glossary DefinitionSourceID values are not updated by this tool. |
| Set PlotAtScale Field Values | Check this box to set all PlotAtScale values in the database. |
| PlotAtScale Value | Enter a number to use for all PlotAtScale values in the database. |
| Set OrientationConfidenceDegrees Field Value | Check this box to set all OrientationConfidenceDegrees values in OrientationPoints |
| OrientationConfidenceDegrees Value | Enter a number to use for all OrientationConfidenceDegrees values in OrientationPoints |
| Calculate Intersecting MapUnit(s) for Point Feature Classes | Check this box to populate MapUnit in all GeMS point feature classes excluding MapUnitLabelPoints and MapUnitPoints. For each point, the intersecting MapUnitPoly will be determined and the MapUnit value added to the point's MapUnit field. If the point intersects more than one MapUnit, each distinct MapUnit will populate the field and be separated by a pipe symbol. If a point does not intersect any MapUnitPolys, the field will be left blank. Your database must contain a MapUnitPolys feature class for this option to work. |
| Path to GeMS Toolbox | Path to the GeMS toolbox. This script will use the GeMS Compact and Backup tool to make a backup of the database in the same directory with a YYYY-MM-DD datestamp added to the end of the file name. Subsequent backups on the same day are appended with sequential letters starting with "a". |
Delete Optional Unused Feature Classes and Tables¶
This tool will take a backup as described in the Introduction before making any changes.
This tool will delete GeMS optional feature classes and tables that have no data. This can be useful to simply the database after you have appended or created data within the feature classes/tables you intend to keep. The following tables and feature classes are never deleted by this tool, even if they are empty:
- AttrRules_CalcFromSymbol
- ContactsAndFaults
- DataSources
- DescriptionOfMapUnits
- Glossary
- GeoMaterialsDict
- MapUnitPolys
- Methods
Note that empty feature class specific domains will remain in the database.
Refer to the table below for parameter descriptions.
| Parameter | Explanation |
|---|---|
| Template Geologic Map Database | Path to the template gdb. This must be a geodatabase in the GeMS schema with a GeologicMap feature dataset and a DataSourceID domain. Provided that the database was generated by this toolbox, it will work with this tool. |
| Path to GeMS Toolbox | Path to the GeMS toolbox. This script will use the GeMS Compact and Backup tool to make a backup of the database in the same directory with a YYYY-MM-DD datestamp added to the end of the file name. Subsequent backups on the same day are appended with sequential letters starting with "a". |
Toggle Legacy PTYPE/LTYPE/PTTYPE Parsing Rules¶
This tool will enable or disable attribute rules that parse PTYPE/PTTYPE/LTYPE fields in a template geologic map database. It will not toggle other attribute rules. Refer to Toggle Standard Attribute Rules/Editor Tracking for a tool to toggle those rules.
| Parameter | Explanation |
|---|---|
| Template Geologic Map Database | Select the template geologic map database to toggle attribute rules and/or editor tracking |
| Toggle Attribute Rules | Select your toggle choice for attribute rules. Note this only affects PTYPE/PTTYPE/LTYPE parsing attribute rules. |
Toggle Standard Attribute Rules/Editor Tracking¶
This tool will enable or disable attribute rules and editor tracking in a template geologic map database.
- Attribute rules covered by this script include those found in the
GeologicMapfeature dataset of a GeMS file geodatabase. It will not disable or enable the rules that parse PTYPE/PTTYPE/LTYPE into GeMS fields. Refer to Toggle Legacy PTYPE/LTYPE/PTTYPE Parsing Rules to toggle those rules. When using this tool to disable all attribute rules, it performs the same function as theDisable Attribute Rules in Output Template Databaseoption in the Create Template GDB tool. - Editor tracking for GeoMaterialsDict is not changed since it is generated without those fields.
- AttrRules_CalcFromSymbol editor tracking is not changed by this tool. By default, editor tracking is always on for this table.
Each toggle option allows you to enable or disable as well as leave unchanged.
| Parameter | Explanation |
|---|---|
| Template Geologic Map Database | Select the template geologic map database to toggle attribute rules and/or editor tracking |
| Toggle Attribute Rules | Select your toggle choice for attribute rules. Note that the PTYPE/PTTYPE/LTYPE parsing attribute rules if present, are not changed by this tool. |
| Toggle Editor Tracking | Select your toggle choice for editor tracking. Note that the GeoMaterialsDict and the AttrRules_CalcFromSymbol tables are not affected by this tool. |
Trigger Attribute Rules¶
This tool will take a backup as described in the Introduction before making any changes.
This tool will trigger attribute rules in a template geologic map database. This is done by using a calculate field expression of Symbol = Symbol, or equivalent depending on the feature class/table. This results in no change to the target field, but still counts as an "edit" which fires calculation and constraint attribute rules.
You can select the specific feature class or feature classes to trigger rules. Only GeMS feature classes with attribute rules and data are selectable. The DescriptionOfMapUnits, Glossary, and RepurposedSymbols tables will be selectable if they have attribute rules and data.
This can be helpful to run after appending clean data to a template database that previously had attribute rules deactivated. One scenario where you may want to trigger rules is to populate GeMS _ID fields with GlobalIDs, which are accomplished via an attribute rule. Another case might be if you change a dependent field in the AttrRules_CalcFromSymbol table, or the DMU and want to trigger attribute rules so that features update to match the new values.
Refer to the table below for parameter descriptions.
| Parameter | Explanation |
|---|---|
| Template Geologic Map Database | Path to the template gdb. This must be a geodatabase in the GeMS schema with a GeologicMap feature dataset. Provided that the database was generated by this toolbox, it will work with this tool. |
| Feature Classes to Trigger | Select the feature classes and/or tables that will have rules triggered. Click "select all" to select all feature classes. Click the blue arrow to unselect all feature classes. Only GeMS feature classes with data and attribute rules are included. The DescriptionOfMapUnits, Glossary, and RepurposedSymbols tables will be included if they contain attribute rules and data. Options are only present after you have specified your Template GDB. |
| Path to GeMS Toolbox | Path to the GeMS toolbox. This script will use the GeMS Compact and Backup tool to make a backup of the database in the same directory with a YYYY-MM-DD datestamp added to the end of the file name. Subsequent backups on the same day are appended with sequential letters starting with "a". |
Import/Export Tools¶
The tools in this group support removal of attribute rules and the option to reimport them later. The Export and Delete
Attribute Rules will create a folder in a location you specify and then export csv files of attribute rules across all
feature classes and tables. It will also make a copy of the AttrRules_CalcFromSymbol table, saving it to a
new file geodatabase in the same folder.
The Reimport Attribute Rules tool can use the folder generated from Export and Delete Attribute Rules to re-add
the AttrRules_CalcFromSymbol table and then re-import all attribute rules. Your template database should have no
attribute rules in it and should not have the AttrRules_CalcFromSymbol present.
Danger
It is crtically important that you do not change any filenames in the folder created by Export and Delete Attribute Rules. You also must not edit any of the file contents. Reimport Attribute Rules looks for import files with a strict naming format. It only proceeds if it can find the AttrRules_CalcFromSymbol table and .csv files for each feature class and table in the template database. It cannot check the content of the individual files and so changes to the file content could cause the import to fail or attribute rules to malfunction.
The naming convention used by the export tool and expected by the import tool is as follows:
- File geodatabase named
YourTemplateGDBName_TableExport.gdbwithAttrRules_CalcFromSymboltable FeatureClassName_attrRules.csvorTableName_attrRules.csvfor ALL feature classes and tables in your template database regardless of whether they actually previously had attribute rules
You can rename the folder everything is saved to, but the default is YourTemplateGDBName_RuleExport. A sequential number starting from 0 is added if a folder with the same name already exists in your selected location.