Writing Multiple Geometry features to Smallworld v4 (Hard Coded)

From fmepedia


This page contains an example FME Workspace created by an fmepedia user.
  See the attached files list at the foot of this page for the zip file containing this workspace.  



From: Safe Software training materials

Table of contents

Workspace

The attached workspace takes data from an AutoCAD dataset (railways.dwg) and adds it to the Cambridge database in Smallworld. In this example there are two Smallworld geometries - a railway centre-line and annotation for each line.


Screenshot


Points to Note

1) A Counter is used to create a unique ID for each line feature. The ID will be used later to join line with annotation.

2) A stream of data is routed through a Labeller to create annotation features for the lines.

3) An Aggregator is used to join each line to its annotation - using the ID number previously defined (group-by = ID)

4) As with the single geometry writing, a user attribute "centre_line" has been defined in the destination feature type. This attribute matches the geometry name in Smallworld. The type of the attribute (as defined in FME) is sworld_chain, which signifies the geometry type - in this case a Smallworld chain feature. However, because this is a multi-geometry feature, there is also a user attribute "annotation" for the label features. This is defined in fme as sworld_text

5) The format list attribute sword_geometry{}.sworld_name has been exposed, and this time two elements in the list exposed, sword_geometry{0}.sworld_name and sword_geometry{1}.sworld_name - These attributes define the Smallworld geometry names.

6) Using a constant the Smallworld geometry names are set to "centre_line" and "annotation" - which are the names of the Smallworld geometry.


Gotchas

1) The list entries 0 and 1 are set to "annotation" and "centre_line" respectively. It is vital then, that the spatial features in the list are also held in the same order (ie annotation first). This can be tricky to guarantee (it may depend on the order in which the connections are drawn!) which is one reason why the list-based method of writing multi-geometries is usually to be preferred.

2) It might happen that a line feature has no matching annotation (for example it has a null field on which the annotation is based). In this case there will be a problem because the hard-coded nature of this workspace causes Smallworld to assume there is a label per line. If this problem arises it will cause a traceback error in Smallworld. Again, this is a reason why the list-based method of writing multi-geometries is usually to be preferred.

Attached Files
filesizedate
multiGeometry1.jpg73.8 kB09/25/06
multiGeometry1.zip85.6 kB09/25/06
User Comments Add a new comment