span8
span4
span8
span4
The schema from source workflow, discussed in theprevious example, will read and write any data in a single workspace.However, the output is always a mirror image of the input, as the destination schema is copied dynamically from the source.
Instead of creating a mirror image, it is possible to map the source data into a new schema, and write that dynamically.This is useful to enforce a particular output or when the desired schema already exists.Any Reader dataset – in any format – can be used as the source for the destination schema by adding it as a Resource Reader.
In this example, an ongoing project provides updated city data in the form of a standardized set of shapefiles.However, each time an update is received, it is in the Autodesk SDF database format.To handle this scenario, a dynamic workspace is created using the standardized shapefiles as schema resources.
1.Add the Source Dataset
Open FME to a new workspace and from the Readers menu select "Add Reader".
2.Add the Destination Dataset
From the Writers menu select "Add Writer".
3.Use Workspace Resources to set the SchemaAdd the following three shapefile datasets to the workspace using a Workspace Resource (Readers menu):
Shapefiles:
Once the resources are added, an entry is placed in the Navigator window:
4.Set the Dynamic Writer to use the New Schema
To map the source data into a new dynamic schema, open the writer feature type and use the “Schema Sources” setting.By default, the schema from the original source dataset is entered into the dialog:
In order to apply the new schema to our destination Feature Type, change the setting to point to the new schema, and not the source:
In the image above, “InteropolisDatabase” is the original source dataset, and has been replaced by the Shapefile resources.Select OK and close the dialog.
5.Schema Mapping
Finally, make sure the workspace contains the correct mappings to match the new schema.In this example, the AttributeManager transformer is used to provide this.Use the table below to create your attribute map.Connect the reader to the AttributeManager, rename the attributes in the following table:
Input Attribute | Output Attribute |
PRIMARYINDEX | PID |
class | ROAD_CLASS |
featureID | FEATUREID |
numberOfLanes | ROAD_LANES |
routeNumber | ROUTE_NUM |
routeType | ROUTE_TYPE |
type | ROAD_TYPE |
name | PARK_NAME |
name_alt | NAME_ALT |
STOPABBR | STOP_ABBR |
STOPNAME | STOP_NAME |
Example:
6.Run the Workspace
Below is an image of the final workspace.Use the run button and then check that the output files contain the correct attribute schema.
The feature types defined by each selected Schema Sources will be logged.
作为一个例子:
读者“SHAPE_1”类型的“形状”公关ovided schema for types: BusStops,CityParks,Roads
If features are destined for a feature type and that feature type is not defined in the Schema Sources, then following type of error message will appear near the bottom of the log file:
Removal of some attributes may be necessary.To to this open up the Writer parameters, open up the dialog for Schema Sources and enable both InterpolisDatabase [SDF3] and BusStops/CityParks/Roads [ESRISHAPE].Then in Attributes to Remove enter:
The first two attributes come from the Shapefile and the other two from from the SDF.Click ok and re-run the workspace.
Dynamic Workflows: Advanced Example - Modifying the Schema Feature
Dynamic Workflows: Destination Schema Derived from Multiple Sources
Dynamic Workflows: Destination Schema as a Mirror Image of the Source Dataset
动态工作流:目的亚搏在线地模式派生的from a Schema Feature
动态工作流:目的亚搏在线地模式派生的from a Lookup Table
Dynamic Workflows: Basics of Dynamics
Dynamic Workflows: Destination Schema Contains Different Feature Type Names
Dynamic Workflow Tutorial: Advanced Technique - Using the SchemaMapper
© 2019 Safe Software Inc |Legal