How to use an Esri Template Geodatabase

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

This article will show you how to use an Esri template in FME. While FME has the ability to create most attributes of a geodatabase, it is strongly recommended to use the native client ArcGIS to do so. The demo will demonstrate how domains and subtypes created inside ArcGIS can be applied to features using FME. By creating ‘The Geodatabase structure’ inside of ArcGIS, the user ensures the most efficient method of migrating or updating data is followed, requiring minimal modifications.
 

What is an Esri Template

An Esri template is a file that can be used to map FME output to a desired schema or structure. The template can either be an XML Workspace Document or a file geodatabase (.gdb). This template will allow FME to create the geodatabase structure with a complete schema of the template, this includes subtypes, domains, relationships, network information, and annotation symbols.
 

How to Use an Esri Template

As stated above, there are two types of Esri templates: a file geodatabase (.gdb) or an XML Workspace document. A geodatabase file is a geodatabase with a pre-defined structure, this can either contain data or not. An XML Workspace document is a simple XML document that contains the definitions of the originating geodatabase. This document contains the schema and possibly the data. When FME uses an XML workspace document, it will only import the schema regardless if the data is attached to the document or not.
 

How to Create an Esri Template

ArcGIS Desktop

In order to create an XML Workspace document, you have to open view the geodatabase in Catalog view (either ArcCatalog or ArcMap will work, or ArcGIS Pro) and right-click the geodatabase > export > XML Workspace Document (export the schema only). This allows the user to determine if the XML document will contain the schema, or the schema and data.
 

ArcGIS Pro

For ArcGIS Pro, the process for creating an XML Workspace Document differs slightly. Rather than being able to right-click and export a document, a tool is required. This can be found under Analysis Tab > Tools > Toolboxes tab > Data Management Tools > Distributed Geodatabase > Export XML Workspace Document. By filling out the parameters, a template will be created.

FME will not use the data from an XML Workspace Document. If you plan to use an XML Workspace Document for schema purposes only, please ensure Export Options is set to Schema Only.

 

Why Use an Esri Template

The main reason to use a template is for simplicity. While the geodatabase structure can be created in FME, it requires more upkeep between translations. If you want to create a geodatabase output using a predefined schema, using an XML Workspace Document or a copy of a file geodatabase is the easiest method of doing so.
This method also ensures that the workspace does not have to be modified extensively to apply updates to the output. This is because the process for creating and applying domains in FME differs. In order to create domains or subtypes with FME, attribute parameters are set as the type domain/subtype_codes. This method works for the initial translation of data, meaning the translation where the output is created for the first time. All proceeding translations to that same output would require the workspace to be altered. Rather than having the data type set as coded_domain/range_domain or subtype_codes, the type would need to be altered to the default fields corresponding data type, for example, 'char' or 'double'. Once the geodatabase has been created, the workspace would need to be altered to apply all future updates.
 

Requirements

The Esri Geodatabase (File Geodb) reader/writer used in the following example requires that a licensed version of ArcGIS be available to the user. For more information on required ArcGIS license levels, please see Required ArcGIS License Types for FME Geodatabase Formats.
 

Video


 

Source

For this example, we will be looking at the City of Vancouver Water and Sewer infrastructure. The data we will be focusing on consists of Control Valves, Hydrants, and different classifications of Watermains (Abandoned, DFPS, Distribution, and Transmissions mains). The domains we will be looking at are the Mains Materials, Diameter, Life Cycle Status, and Lining features. The domains and their possible values for each are as follows:

Domain Name: wDomainMainMaterials

Ductile Iron Cast Iron Wood Galvanized
High Density Polyethylene Poly Vinyl Chloride Asbestos Concrete Concrete
Steel Clay Copper Unknown
Other      


Domain Name: wDomainMainDiameter

20 25 30 40 50 65 75 100
150 200 250 300 350 400 500 550
600 675 700 750 775 800 850 900
1000 1050 1200 1350 1500 1800 1900  


Domain Name: wDomainLifecycleStatus

Proposed Active
Removed Abandoned

 

Domain Name: wDomainLiningMaterial

Cement Lined CENT
Coal Tar Epoxy

 

sourcedata.jpg

 

Step-by-step Instructions

1. Start FME Workbench
Start FME Workbench, in Windows, this is found under Start > All Programs > FME Desktop > FME Workbench. Also download the attached data which can be found under the Files section of this article, if you do not have it already, unzip it.
 
2. Open Workspace
Open the attached TemplateWorkspaceStart.fmwt
Inside the workspace, you will see AttributeManager transformers connected to each of the reader feature types. These are used to correctly map domains to their corresponding reader feature.
AttributeManagerOverview.png

This image shows the Control Valve CAD feature, having its attributes mapped to the correct output field and domain definition.
The 2DForcer that is attached to the watermain and hydrant features ensures the features are two-dimensional.
The AttributeValueMapper transformers attached to the watermain features map the corresponding feature to the domains. In this case, the first AttributeValueMapper maps the source values to the correct domain for Materials. The second AttributeValueMapper maps the source values to the correct domain for the Lining attribute.
 
3. Add a Writer to the Workspace
There are two different methods of adding a writer to the canvas to use the correct schema, either an XML Workspace Document or a file geodatabase template.

If following along with this demo, only select one of the options, or delete the writer before following along with the other option. 

 

Option 1: XML Workspace Document

Add an Esri Geodatabase (File Geodb) writer to the canvas. Next, select a location and name for the future geodatabase. Set the Feature Class or Table Definition to Import from Dataset. Then click Parameters.
TemplateReader.png

For Import XML Workspace Document (Schema Only), select the XML Workspace document provided (XMLWORKSPACEDOC.XML).
XMLDoc.png

If writing to an existing geodatabase that contains a different schema, you can ‘check’ the Overwrite Existing Geodatabase option. This option will overwrite and delete both the data and schema of an existing geodatabase if your output geodatabase location contains a geodatabase with the same name.

Click OK twice.
When the Import Writer Feature Types Dialog appears, set the format to Esri Geodatabase (XML Workspace Document) and the dataset to the provided XML workspace document. Click OK.
ImportFT.png

When the Select Feature Types Dialog appears, Select All, then click OK.
SelectFeatureTypes.png
 

Option 2: .gdb File Template

Add an Esri Geodatabase(File Geodb) writer to the canvas and select a location and name for the future geodatabase. Set the Feature Class or Table Definition to Import from Dataset. Then click Parameters.
TemplateReader.png

In the parameters dialog, enable Overwrite Existing Geodatabase then set the Template File Geodatabase to SourceGeodatabase.gdb, and click OK twice. 
OverwriteGeodatabase.png

Overwrite Existing Geodatabase must be checked in order to use an existing .gdb file as a template.

 
In the Import Writer Feature Types dialog, set the Dataset to the source template (SourceGeodatabase.gdb), then click OK. 
ImportFT.png

When the Select Feature Types Dialog opens. Select All, and then click OK.
SelectFeatureTypes.png

4. Map Input Features to Output Features
Connect the Control Valve flow to the wControlValve output, the Hydrants flow to the wHydrant, and the 4 different main features to the wMain feature.
 
Now we need to manually map a couple of attributes. Expand the 2DForcer_2 as well as the wHydrant. For the wHydrant feature, manually map ASSET_NUMBER to FacilityID, and OFFSET_FROM_VALVE_M to LocationDescription by clicking and dragging from the arrows. 
HydrantMapping.png

Then, for the wMain feature, manually map the DIAMETER_MM to Diameter.
MainMapping.png

5. Save and Run the Workspace.
Save then workspace and then run it. A new geodatabase will be created complete with the attached schema. View your results using ArcMap. 
ArcOutput.png

Check the wMain, wHydrant, and wControlValve features to ensure the domains were followed.
OutputDomain.png

 

Data Attribution

The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.