Tips for Using the Generic Writer
Geometry
The Generic writer supports the full range of point, line, polyline, arc, ellipse, rectangle, rounded rectangle, region (polygon), text, null, and raster geometric data. Similarly, it supports the full range of attribute types. Individual writers may be unable to support all data types, and errors may result if unresolvable incompatibilities are encountered.
The Generic writer will allow different types of geometry to be written to an single output feature type – if the true writer at run-time does not allow this, separate output feature types will be created by appending a geometry-name suffix to the base feature type in order to separate features with different geometries from each other. For example, if the Esri Shapefile writer was chosen at run-time as the target writer, and a single feature type called rivers was set up to accommodate multiple geometries, then any linear features sent to the rivers feature type would end up in a shapefile named rivers_line.shp, and any point features would be sent to rivers_point.shp.
Feature Type Definitions
The output feature type definitions for the Generic writer are usually explicitly specified, but the writer also offers a Dynamic Schema setting, in which the output features’ definitions are based on schema information from the workspace’s source readers.
For more information on this setting in Workbench, see About Dynamic Workspaces.
Writing to Multiple Formats
When the Generic writer is used, it is sometimes useful to pre-configure parameters that are specific to individual output formats. For example, to write to a Design file, a seed file must be specified.
To do this, add an additional writer to a workspace. This causes Workbench to think that there is more than one output format, and forces Workbench to create a Multiwriter for the workspace. The first writer in the multi-writer will be the Generic writer, and this one should have all the output feature types. The second writer will have no feature types, but will be used to communicate any format-specific writer settings to the Generic writer, when that format is used as the format for the Generic writer.
If the Generic writer is configured to write to a format requiring a filename as a dataset, the Generic writer will turn the output folder into a filename by appending a file extension to the last portion of the folder name. When format-specific settings are present, this extension is taken from the dataset specified for the specific format. The rest of the dataset is ignored.
Notes
- You can only specify one output format in the Generic writer when you set up a workspace. You can publish the format as a Published Parameter, and then select the output format each time the workspace runs.
- You can also set up one dedicated writer for multiple output formats and use a Tester/TestFilter to route features to the desired writer (for example, based on a published parameter).
- The FME Community contains some information about using Generic writers.