Files
Introduction
Welcome to the FME for Smallworld 5 tutorial. This article covers importing data into your Smallworld 5 database, including instructions on importing a simple geometry object.
Considerations for Import
FME can’t create new objects in the Smallworld database. You can only load into existing objects. This means that on import, the FME Smallworld writer data schema must accurately match the existing Smallworld object schema. This includes making sure you know which fields and geometries are mandatory, and also ensuring that you load valid enumerated list (domain) values. It’s useful to obtain a descriptive CASE report of the Smallworld objects that will receive the imported data.
Before starting any data import, it's a good idea to inspect both the source dataset in the FME Data Inspector and the Smallworld objects to obtain a full understanding of the data schemas
Steps for Successful Import
- Identify the correct Smallworld alternative or version to import into. FME will make the alternative writable. But FME cannot create a new alternative.
- Use FME Data Inspector with the FMENOFACTORY service to inspect existing Smallworld records in the target object. Take note of the data schema that will need to be created in the FME workspace.
- Create the FME Workspace in FME Workbench to translate the source dataset schema into the destination schema on the Smallworld objects.
- Test the workspace using the ‘Redirect to Inspection Application’ menu option to ensure that the data is restructured as planned.
- Import the data into a test alternative and check the results.
- Import the data into the production alternative or “top” alternative – consider setting a checkpoint before running FME so you can roll back if needed.
- Inspect the updated Smallworld objects to verify that the imported data is loaded correctly.
Import Simple Geometries
The Electricity Cable objects in the Smallworld database have a single Centreline geometry. You’re going to import some proposed cables for a new subdivision into the Cambridge database from an AutoCAD 3D Map dataset. First, inspect the destination Smallworld objects and the source AutoCAD dataset.
Step-by-step Instructions
1. Inspect Source Dataset
Download the electric-networkproposed.dwg dataset from the Files section on the right.
Open the FME Data Inspector. Click on File > Open Dataset:
Using FME Data Inspector, open the source electric-networkProposed.dwg using the Autodesk AutoCAD RealDWG DWG/DXF reader. On the Parameters, under 'Group Entities By ', set AttributeSchema. Set the coordinate system (OSGB-GPS-2015).
Take a look at the "Proposed" cables in the electricity_cable layer. In this exercise, we will import these cables into our Smallworld Cambridge database.
2. Compare the Electricity Cable in Smallworld and in FME Data Inspector
Using the Smallworld Application Manager, open the FME Import & Export application and inspect the Cambridge sample database.
If you have created a bookmark for the Electricity Network, use the bookmark to zoom in on the Cambridge electric network data. You can also zoom in on the electric network by going to the folders on the bottom left -> My Datasets -> Electricity -> Electricity Network -> Substation. On the bottom right, right-click on the Union Lane Substation and select 'Go To'.
Inspect a few different objects in the electricity network and check the object Editor for attributes and geometry.
In the FME Data Inspector. Click on File > Open Dataset:
Reader: Smallworld 4/5
Reader Dataset: localhost:30000
Parameters > Service: FMENOFACTORY
Parameters > Table List: electricity.cable
Parameters > Coordinate System: OSGB-GPS-2015-OSTN15
As of FME 2025.2, the Coordinate System parameter is now configured within the Parameters dialog of each reader/writer format. For more information, including details about the change and affected transformers, please see Coordinate System Parameter Location Change.
Click on the “Union Lane LV” cable feature
Compare the Smallworld and FME representations of the electricity.cable.
In FME, the cable geometries are represented by a single geometry (centerline) - in the case of “Union Lane LV,” a multi-segment path geometry.
3. Inspect Destination Schema
In the Smallworld GIS, use the Editor to inspect the electricity.cable objects schema. Notice that the sys_id field is named ‘id’ is the key field. If you look at a CASE report of the electricity.cable it is a mandatory field.
The Status attribute is an enumerated list with possible values:
- In service
- Abandoned
- Accepted
- Out of service
- Proposed
- Removed
The voltage attribute is an enumerated list with possible values:
- 11kV
- 132kV
- LV
When loading the Status or Voltages attribute, you need to ensure that one of these mandatory enumerated values is set.
Take note of how the source schema relates to the destination schema:
| Source AutoCAD | Destination on Smallworld | Action |
| id | id | Match FME feature with Smallworld object |
| length | -- | Not updated because it is a calculated field |
| known_as | known_as | |
| status | status | Make sure value matches enumerated values |
| voltage | Voltage | |
| Geometry Name | centreline |
In this example, there is not much schema mapping involved. In most cases, you’d need to add FME schema-mapping transformers such as AttributeManager, AttributeCreator, AttributeRenamer, AttributeValueMapper, or SchemaMapper.
Note that the Smallworld geometry has a name: centreline
4. Select the Smallworld Destination Alternative
In the FME Import & Export application, click on File > Versions to open the Version Management application.
In the Version Management application, add a new alternative if it doesn’t already exist:
- Dataset: Electricity
- Name of Alternative: fme_training
Double-click on the alternative to make it the current alternative.
5. Generate Workspace
Open FME Workbench and on the Start tab, choose the Generate Workspace option.
-
Reader:
- Format: Autodesk AutoCAD RealDWG DWG/DXF
- Dataset: electric-networkproposed.dwg
-
Parameters:
- Group Entities By: Attribute Schema
- Expand Blocks into Entities: UNCHECK
- Coordinate System: OSGB-GPS-2015-OSTN15
-
Writer:
- Format: Smallworld 4/5
- Dataset: localhost:30000
-
Parameters:
- Service: FME
- Search Envelope: |fme_training
- Coordinate System: OSGB-GPS-2015-OSTN15
Be sure to use the | symbol as the first character for Alternative
When you uncheck the Expand Blocks into Entities, FME will only read the insertion point for that block and will not read the block definition. This is usually what you want when loading CAD data into a GIS.
In the Generate Workspace dialog, place a check mark on the “Import feature type definitions” checkbox. Click OK.
Click OK
6. Import Writer Feature Types from Smallworld
The “Import Writer Feature Types” dialog will appear. Enter the usual Smallworld connection parameters.
Click on the Parameters button, and select:
- Table List: electricity.cable
Click OK to close the import feature types dialog.
7. Select AutoCAD Layers
The Select Feature Types dialog will open. This is the AutoCAD layer selection. Select electricity_cable and OK, to generate the workspace.
It is advisable to use the Import Writer Feature Types option whenever a Smallworld writer is added. The Smallworld schema will generally be different from the reader schema, and the correct schema can only be obtained by explicitly importing the Smallworld feature type schema.
8. Save Workspace
Save the workspace locally at: <My Documents>\My FME Workspaces\Smallworld4.fmw
9. Connect Reader and Writer Feature Types
Connect the electricity_cable reader feature type to the new electricity.cable writer feature type.
Expand the attribute lists for the reader and the writer.
The FME Smallworld 5 writer handles Smallworld geometries in a completely different way to Smallworld 4. The Smallworld 4 versions of the workspaces are all attached at the bottom of this article for reference. Geometry types are no longer exposed as attributes and no longer use the sworld_geometry{} list attributes. Old workspaces are still compatible in Smallworld 5.1.
10. Filter the Proposed Cables
You only need to insert the proposed cables. Add a Tester transformer to keep the “Proposed” cables.
11. Set Geometry Name
In the Data Inspector, we noticed that the cable object has a geometry name 'centreline'. You need to set the name of the FME geometry to match the name of the Smallworld geometry column.
Add a GeometryPropertySetter after your Tester and set:
- Property to Set: Geometry Name
- Geometry Name: centreline
Click OK on the GeometryPropertySetter parameter dialog. You can change the name of the reader/writer feature types bookmark to the reader and writer names.
Your workspace should look something like this:
12. Save and Run
Save the workspace. Run the translation.
Inspect the updated data in the FME Import & Export application. The proposed cables have been added along Oak Tree Avenue. You might have to select View – Refresh.
Open the folders My Datasets -> Electricity -> Electricity Network and select Cable.
Problems?
The most common data load error is failing to load the Smallworld geometry correctly.
In Smallworld Explorer, if the geometry column is not flagged or the Length is 0.0, then you have probably not set the geometry name correctly in the GeometryPropertySetter. In FME, in the Navigator window -> Workspace Parameters -> Order and Redirect -> click on Writer Redirect -> select 'Redirect to Data Inspector' and re-run the workspace.
Inspect the results in Data Inspector to ensure the geometry name is configured correctly.
13. Clean-up
In the next section, you’ll reload the data. In the Smallworld version manager (File -> Versions), select the 'fme_training' alternative, then roll back to the checkpoint that was saved before you inserted the proposed cables by double-clicking the checkpoint (bottom right) and selecting Rollback to Checkpoint. If a checkpoint was saved after you inserted the proposed cables, you could also delete the current checkpoint.
Before you delete anything, you can double-click each checkpoint and inspect it on the map and/or the Smallworld Explorer to see which checkpoint you want to go back to.
Or in the Smallworld Explorer, select all the Oak Tree Avenue LV records you just inserted, delete them, and commit the deletes. This will give you a fresh start.
Database Operations
At this point, you let FME default to a database insert operation. If we wanted to update the existing cable features, we’d need to use an update operation. The fme_db_operation format attribute is used to do updates. FME uses the ‘fme_db_operation’ attribute on the Smallworld writer features to specify the database operation for each feature. The fme_db_operation attribute can be set to:
- INSERT
- UPDATE
- DELETE
We’re going to discuss the fme_db_operation attribute in more detail in a later article in this tutorial series.
In the next steps, you’re going to set the value of the 'known_as' attribute to “connector”, if it has a null value in the AutoCAD dataset.
1. Edit Workspace
Continue editing the workspace you’ve been working with, or open the workspace smallworld4a-complete.fmwt.
The completed workspace for this section is: smallworld4b-complete.fmwt.
2. Modify Tester
You do not need to update the named cables, such as “Union Lane LV” or “Lower Milton Rd LV,” to filter them out. Open the Tester properties and add the test:
known_as Attribute Is Empty String3. Add Conditional Tests to AttributeCreator
Insert an AttributeCreator transformer between the Tester and the GeometryPropertySetter. Now add a couple of conditional expressions to the AttributeCreator. To create a conditional expression in AttributeCreator, use the menu on the Attribute Value column and select Conditional Value…
The first conditional expression will set the known_as attribute:
if known_as is "attribute is empty sting" then Output Value to "connector"and then to set the fme_db_operation attribute:
if status = "In service" then Output Value is UPDATE
else if status = "Proposed" then Output Value is INSERTRemember that FME is case-sensitive for both attribute names and attribute values
The workspace will now look something like:
4. Test the workflow
When creating more complex workflows, it’s a good idea to test them before loading the data into the database. In Workbench, in the Navigator window -> Workspace Parameters -> Order and Redirect -> click on Writer Redirect -> select 'Redirect to Data Inspector'.
Then run the workspace, check the feature counts on the workspace connectors, and verify the results in FME Data Inspector or Data Preview. You should see all the cables, except those that had a value for “known_as”. All the “known_as” values should be either “connector” or “Oak Tree Avenue LV”. “In service” cables should have an fme_db_operation = UPDATE. The “Proposed” cables should have an fme_db_operation = INSERT.
5. Save and Run
In FME Workspace Parameters, set Writer Redirect to 'No Redirect'. Save the workspace. Run the translation.
Inspect the updated data in the Professional - Smallworld Core application. You may need to change the version (File -> Versions -> Dataset: Electricity -> double-click on fme_training).
You have loaded some cables into the fme_training alternative and updated some of the existing cables.