Description

String concatenation is when a user joins together (concatenates) attributes on a feature. This transformer works with attribute values and also permits 'constant' values to be included. Constants are user defined characters or strings that are the same for every feature.

For example:

Address1  Suite 2017
Address2  7445-132nd Street
City      Surrey Province  British Columbia PostCode  V3W 1J8 
Constant1 ,

Address =  Address1+Constant1+Address2+Constant1+City+Constant1+Province+Constant1+PostCode 
Address = Suite 2017,7445-132nd Street,Surrey,British Columbia,V3W 1J8


Related transformers are the ListConcatenator and the CoordinateConcatenator.

Example Scenario

Concatenation is a natural complement to FME's fanout functionality, as it provides a way to fan out by more than one attribute simultaneously.

An FME user has a set of zoning data covering the entire city of Interopolis and a dataset containing a set of grid squares.

User-added image
Above: The source data: city grid overlaid on zone data

The user wishes to both tile the zoning data into grid squares and subdivide it up into one Shape file per zone type.

  • Tiling the data with a Clipper transformer and fanning it out on the grid square ID (Square1, Square2, etc) is simple:

User-added image
Above
: The zoning data fanned out by city grid

  • Fanning out by the zone type (Commercial, Industrial, etc) is also easy enough:

User-added image
Above: The zoning data fanned out by zone type

  • However, to do both fanouts at once requires the grid square ID and zone type attributes to be concatenated together into a new attribute:
 Square1-Commercial.shp Square1-Industrial.shp Square1-Residential.shp Square2-Commercial.shp Square2-Industrial.shp etc  

Workspace Description

In the workspace:

  • Source datasets are passed into a Clipper transformer; city grid as the clipper, zoning data as the clippee.
  • Zoning data is clipped by the grid features and output with the grid square ID attached.
  • Grid square ID and zone type attributes are concatenated together to form a new attribute "_fanoutAttribute".
  • Destination feature type has a fanout applied using the attribute "_fanoutAttribute"

Notes

  • The StringReplacer transformer replaces all instances of the "/" character in zone names. This would cause a problem in the fanout because it would form an invalid file name.
  • The City Grid dataset is read first (uppermost in the Navigator pane). This allows the Clipper to be run in the more efficient "Clippers First" mode.

Output

User-added image

Above: The output. The L28 (L29, etc) part is the grid square ID. The LI (RR, SF, etc) part is the zone type.