FME Version
Files
Introduction
The schema for a dynamic workflow usually comes from the source dataset or a template dataset (such as a shapefile or database table, as seen in the previous examples). Another option is to use a lookup table, which contains the schema definition and is usually stored in a text file or spreadsheet. A benefit of this type of resource is that the content can be maintained outside of the FME environment and can be updated easily.
Workspace and Data
The workspace referenced in this example can be found in the zip file attached to this tutorial, titled "4-LookupTable".
Step-by-Step Instructions
In this scenario, a set of feature types representing city data needs to be translated from OGC Geopackage into shapefiles for production. The desired schema is different from the input Geopackage schema and has been defined in a spreadsheet:
The author has listed the feature types, attributes, and geometry types that define the output schema.
Creating a Table-Based Schema
When using a spreadsheet or lookup table to define the schema, the table must have a row for each attribute with fields that provide the following information:
- Feature Type Name
- Used by the writer to define which feature type should use which attributes.
- Attribute Name
- Attribute Data Type
- Possible values are listed here. [Note for the type "fme_decimal(width,decimal)" : if the schema is in a CSV file then quote this value to protect the comma, e.g. "fme_decimal(10,2)".]
- Geometry Type
- A semi-colon separated list of values representing the type of geometry provided.
- A value only needs to be entered once per feature type in the row defining the first attribute for the feature type (see Attribute Order).
- Possible values are the same as the possible values for the fme_type FME format attribute and are listed here.
- Attribute Order
- An optional number indicates the position of the attribute in the feature type.
Connecting to the Lookup Table in FME Workbench
1. Open Workspace
Open the attached 4-LookupTable.fmwt workspace, then review the Workspace Resource in the Navigation pane. The Workspace Resource was added by going to the Reader menu, and selecting "Add Reader as a Resource."
In the parameters:
- Format: Schema (From Table)
- Dataset: <Tutorial Download>\resources\destination_schema_def.csv
In the parameters dialog, specify which fields in the table represent which parts of the schema:
The table will then be loaded as a Workspace Resource and can be seen in the Navigator pane:
2. Set Lookup Table in Writer
Open the writer parameters, click on the ellipsis next to Schema Sources, and select [SCHEMA_FROM_TABLE].
Additional Resources
Data Attribution
The data used here is adapted from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.