Working with Geodatabase Metadata: Writing/Updating Metadata

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0


A metadata record is a file of information - usually presented as an XML document - that captures the basic characteristics of a data or information resource. Geospatial metadata is used to document geographic digital resources such as Geographic Information System (GIS) files, geospatial databases, and earth imagery.
A geospatial metadata record includes core library catalog elements such as Title, Abstract, and Publication Data; geographic elements such as Geographic Extent and Projection Information; and database elements such as Attribute Label Definitions and Attribute Domain Values.


Reading Geodatabase Metadata

Reading geodatabase metadata is triggered by setting the geodatabase reader parameter – Feature Read Mode – to 'Metadata'. When reading metadata, the reader feature types have a completely different schema than when reading features. Instead of listing user attributes, a metadata feature type lists a number of metadata fields, including geodb_metadata_string (an XML string containing the geodatabase metadata) while other format attributes store information such as dimension, spatial column, geometry, etc.

In metadata mode, only a single feature is output from the feature type. This means that to read features and metadata you need two geodatabase readers: one to get the features and one to get the metadata.


Writing Geodatabase Metadata

Writing metadata occurs when a feature of the correct type is written to the table to which the metadata applies. A metadata feature must have the correct geometry type (i.e. have the geodb_type format attribute set to ‘geodb_metadata’) and the metadata being written should be held as XML in the format attribute - 'geodb_metadata_string'. It will overwrite any previous metadata that was on the table/feature class. If multiple metadata features are written to the same table, then the final feature is used.

Note that the destination feature type (table) should be that of the geometry type (point, polyline, etc.).



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.

Source Data

BikePaths_L (Esri Shapefile)



BikePaths_L (XML Document)


In the above images, we see a visualization of the BikePaths_L shapefile and of a section of the BikePaths_L XML file.


Step-by-step Instructions

1. Read Source Data

Bike Path feature geometry is read from the source shapefile using the Esri Shapefile reader while Bike Path metadata is read from an XML document using the XML (Extensible Markup Language) reader. These files will provide the features and metadata for the destination feature class. 
Open FME Workbench and start a blank workspace. Add an Esri Shapefile reader to the canvas and browse to the BikePaths_L.shp dataset, which can be downloaded from the Files section on this article. Since there are no other parameters to set, click OK to add the reader. 

Next, let’s add the metadata. Add an XML (Extensible Markup Language) reader to the canvas and browse to the BikePath_L.shp dataset, then open the Parameters. 

In the parameters, click on the ellipsis next to Elements to Match and select metadata. Then click OK twice to add the reader. 


2. Define XML Feature as Metadata 
An AttributeCreator is used to create a metadata string attribute (geodb_metadata_string) that will hold the incoming XML definition contained in the xml_fragment attribute. In addition, the AttributeCreator will also be used to define the destination geodatabase format as metadata. This is done via the use of a format parameter (geodb_type) set to the value geodb_metadata. 
Add an AttributeCreator to the canvas and connect it to the metadata reader feature type. In the parameters, create the following attributes:

New Attribute Attribute Value
geodb_metadata_string xml_fragment
geodb_type geodb_metadata


3. Update XML Metadata
By looking at a section of the incoming metadata, we can see that a value indicating a minimum bike path length has not been applied to the metadata.

The XMLUpdater transformer will be used to update the incoming metadata with a new value. Add an XMLUpdater to the canvas and connect both the Document and Update input ports to the AttributeCreator. In the XMLUpdater parameters, set the XML Text to geodb_metadata_string, since there are lots of attributes it is easiest to type it in instead of using the Attribute Selector. Next, in the Updates section set the following values:

  • Update Type: Replace Contents
  • XML Path: /metadata/dataIdInfo/idPurp
  • Value Type: Plain Text
  • Value: Data for Bike Paths that are over 15 km long

Finally, set the Result Attribute to geodb_metadata_string.

Basically, this transformer will take the metadata string, replace the path we chose with the new value, and write the new value back to the same attribute.
4. Combine Line Features
Now let’s clean up the bike path line features as they are fragmented. Add a LineCombiner to the canvas and connect it to the BikePaths_L reader feature type. In the parameters, set the Combine On Attributes to PathId, PathName, and PathType, then click OK. 

5. Calculate Path Length
Now that we’ve combined the bike path fragments into a single line per PathId, let’s calculate the new length. Add a LengthCalculator to the canvas and connect it to the LineCombiner. In the parameters, set the Length Attribute to PathLength and click OK. 

6. Write Features and Metadata
Now our data is ready to write out. Add an Esri Geodatabase (File Geodb)  writer to the canvas and specify the output geodatabase to which the data will be written (i.e. VancouverCity). Be sure that the Feature Class or Table Definition is set to Copy from Reader, then click OK. When prompted to select a feature type, be sure to select BikePaths_L [SHAPEFILE]. 

Once added, connect the output of the XMLUpdater and LengthCalculator to the BikePaths_L writer feature type. As an optional step, double-click on the geodatabase writer and, under General, rename the feature class/table name to "BikePaths". 
7. Save and Run the Workspace
Now, save and run the workspace. View the output geodatabase in Esri ArcCatalog to view the metadata. 

Data Attribution

The data used here originates from data made available by the City of Vancouver, British Columbia, as well as fictional data created for this article.  The City of Vancouver data contains information licensed under the Open Government License - Vancouver. 

Was this article helpful?



Please sign in to leave a comment.