Sei sulla pagina 1di 37

FME® Desktop Tutorial

S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Safe Software Inc. makes no warranty either expressed or implied, including, but not limited to, any implied warranties of merchantability or fitness for a
particular purpose regarding these materials, and makes such materials available solely on an “as-is” basis.
In no event shall Safe Software Inc. be liable to anyone for special, collateral, incidental, or consequential damages in connection with or arising out of
purchase or use of these materials. The sole and exclusive liability of Safe Software Inc., regardless of the form or action, shall not exceed the purchase
price of the materials described herein.
This manual describes the functionality and use of the software at the time of publication. The software described herein, and the descriptions themselves,
are subject to change without notice.

Copyright
© 1994 – 2009 Safe Software Inc. All rights are reserved.

Revisions
Every effort has been made to ensure the accuracy of this document. Safe Software Inc. regrets any errors and omissions that may occur and would
appreciate being informed of any errors found. Safe Software Inc. will correct any such errors and omissions in a subsequent version, as feasible. Please
contact us at:
Safe Software Inc.
Suite 2017, 7445 – 132nd Street
Surrey, BC
Canada
V3W1J8
www.safe.com

Safe Software Inc. assumes no responsibility for any errors in this document or their consequences, and reserves the right to make improvements and
changes to this document without notice.

Trademarks
FME is a registered trademark of Safe Software Inc.
All brand or product names mentioned herein may be trademarks or registered trademarks of their respective holders and should be noted as such.

Documentation Information
Document Name: FME Desktop Tutorial
Version: FME 2010
Updated: December 2009

ii
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Contents
Chapter 1 Getting Started ................................................................................................................................... 1 
In this chapter ............................................................................................................................................. 1 
Installing FME .............................................................................................................................................. 1 
Licensing FME .............................................................................................................................................. 1 
Installing the FME sample dataset ................................................................................................................... 1 
Getting help ................................................................................................................................................ 2 

Chapter 2 Inspecting Data – FME Universal Viewer ............................................................................................. 3 


In this chapter ............................................................................................................................................. 3 
Objective .................................................................................................................................................... 3 
Viewing data ............................................................................................................................................... 3 
Viewing geometry and attributes ............................................................................................................ 5 
Getting coordinate system information .................................................................................................... 6 
Overlaying data in different formats ................................................................................................................ 6 
Inspecting raster data ................................................................................................................................... 8 

Chapter 3 Quick Translations – FME Universal Translator ................................................................................. 11 


In this chapter ............................................................................................................................................ 11 
Objective ................................................................................................................................................... 11 
Running a quick translation...........................................................................................................................12 
Reprojecting data ........................................................................................................................................ 13 

Contents iii
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Chapter 4 Translations – FME Workbench ........................................................................................................ 16 


In this chapter ............................................................................................................................................ 16 
Getting started with Workbench ....................................................................................................................16 
Workbench interface ............................................................................................................................16 
Menu bar and Toolbar ..................................................................................................................17 
Workbench elements ....................................................................................................................18 
Color definitions ..........................................................................................................................18 
Quick changes .................................................................................................................................... 19 
Renaming attributes.....................................................................................................................19 
Creating new attributes ................................................................................................................19 
Editing existing attributes .............................................................................................................20 
Inserting transformer connections ..................................................................................................20 
Inserting vertices on links .............................................................................................................21 
Basic Workbench tasks................................................................................................................................. 22 
Creating a translation (workspace).........................................................................................................22 
Inspecting your data ....................................................................................................................23 
Using transformers ..............................................................................................................................24 
Filtering the Geometry .................................................................................................................24 
Intermediate Workbench tasks ......................................................................................................................28 
Processing multiple files .......................................................................................................................28 
Advanced Workbench tasks ..........................................................................................................................30 
Adding a new reader to your workspace..................................................................................................30 
Spatially Filtering the Data ....................................................................................................................31 

Contents iv
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Chapter 1

Getting Started

In this chapter Licensing FME


• Installing FME
To license FME, run the FME Licensing Wizard available
• Licensing FME under Start > Program Files > FME and answer the
• Installing the FME sample dataset questions asked by the wizard.
• Getting help
Note: This tutorial is designed specifically for use with
FME 2010. You may not have some of the functionality
described if you use older versions of FME.
Installing FME
The FME installer is a single application and is the only
installer for all FME license levels.
Installing the FME sample
dataset
1. FME requires administrative privileges to install. You
may require assistance from your system Download the FME Sample Dataset from
administrator.
www.safe.com/sampledata and extract the contents to your
2. Double-click setup.exe. C: drive.
3. Answer the questions asked by the Installation Note: You can access this Tutorial at www.safe.com/tutorial
Wizard. For more information, see the FME also.
Installation and Licensing Manual.
Chapter 1: Getting Started 1
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Getting help
FME products include extensive, context-sensitive help. If
you require assistance with a tool or format, click the item
and press F1 to open the help system.

If you have questions about licensing or installation,


please e-mail support@safe.com.

Chapter 1: Getting Started 2


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Chapter 2

Inspecting Data – FME Universal Viewer

1. To start FME Universal Viewer, click Start > All


In this chapter Programs > FME > FME Universal Viewer.

2. Click File > Open Dataset, which opens the Select Dataset
• Objective
to View dialog shown next.
• Viewing data
• Overlaying data in different formats
• Inspecting raster data

Objective
You’ve received data in a variety of formats and you want
to familiarize yourself with that data using FME Universal
Viewer.
Fields that have a red background, as shown above,
are mandatory fields.
Viewing data
3. To specify the format of the file you want to read, do
one of the following:
FME Universal Viewer is a tool for visually inspecting
spatial datasets. In this exercise, you’ll use the Viewer to • Click in the Format field and start typing mapi. As
view geometry, attributes, and coordinate system you start typing, you see a filtered list, with
information of various datasets.
Chapter 2: Inspecting Data – FME Universal Viewer 3
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

MapInfo TAB (MFAL) highlighted. Press Enter or click Click OK to accept this format, close the Reader
to select it. Gallery, and return to the Select Dataset to View
dialog.
• To open the Reader Gallery (shown next), click the
Browse button at the right of the Format field. 4. Click the Browse button for the Dataset field to open a
Scroll down the list of formats and select MapInfo file browser in which you select the TAB data to view.
TAB (MFAL). Browse to C:\FMEData\Data\Parks and select the file
city_parks.tab, shown next.

5. Click OK, which opens the TAB file in the Viewer,


shown next.

Tip: You can quickly filter the formats shown in the


Reader Gallery by clicking in the Search field and
typing the first four characters of the format name.
In this case, type mapi.

Chapter 2: Inspecting Data – FME Universal Viewer 4


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Viewing geometry and attributes


Now you have the TAB file open in the Viewer. The
geometry is visible, but no attributes are showing.

1. You can see when the Information tool is activated in


one of the following ways:

• On the toolbar, when the button is active it looks


like this: .

• Place your cursor on the View window. If you see


the letter i to the right of your cursor, the
Information tool is active.

If the Information tool on the toolbar is not already


selected, click to put the Viewer into the Inform
mode.

2. On the View window, click any of the representation’s


features.
This action shows details about the feature’s attributes
in the Information pane, which is visible at the right side
of the window.
Tip: To show the details for a selected set of multiple
features, drag a box across a portion of the
representation. On the Information windows, move
through the individual features in the selected set by
clicking the Forward and Back buttons next to
the Feature field on the Information pane.

Chapter 2: Inspecting Data – FME Universal Viewer 5


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Getting coordinate system Overlaying data in different


information formats
On the Information window in the Coord Sys field notice that At this point, you’ve used FME Universal Viewer to read a
the coordinate system’s short name TX83-CF is shown. single MapInfo TAB dataset.
1. To see the description of parameters for this
A great feature of FME Universal Viewer is its ability to
coordinate system, click the Browse button next to the
overlay multiple datasets in different formats within a
Coord Sys field.
single window.
The Coord Sys Info dialog opens, shown next, where
you can view detailed information about the coordinate In the next exercise, you add a Bentley MicroStation
system. Design file to the TAB data.

1. On the Viewer’s toolbar, click to open the Select


Dataset to Add dialog, shown next.

2. In the Format field type dgn and select Bentley


MicroStation Design (V8), shown next.

2. Click Close to close the Coord Sys Info dialog. Tip: By selecting the format before the dataset, you
see only those datasets that correspond to the
requested format. This narrows your search and
makes it quicker to find what you need.

Chapter 2: Inspecting Data – FME Universal Viewer 6


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

3. In the Dataset field, click the Browse button and


navigate to C:\FMEData\Data\Roads\MajorRoads.dgn.
Click Open to accept this file and to return to the Select
Data to Add dialog, shown next.

4. Click the Parameters button.


The Bentley MicroStation Design (V8) Parameters dialog
opens, shown next.
In the Group Elements By location, click the option
button in front of Schema – Level Names.
All other settings as shown are fine for this example.

Click OK to accept the settings, which returns you to


the Select Data to Add dialog.

Chapter 2: Inspecting Data – FME Universal Viewer 7


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Click OK again to load the data into the Viewer, which 1. Open Windows Explorer and browse to
should look similar to the image shown next. C:\FMEData\Data\Raster and select InteropolisCentre.png.
Drag this file onto the View window.

2. The Select Dataset to View dialog opens, shown next,


with the Reader Format and Dataset fields populated.

Click OK. The raster dataset is loaded into the View


window, shown next.

On the Display Control window, you see two items


listed for this dataset—Roads and Labels. These are
two different layers in the source data. In FME, these
layers are called Feature Types.
Because you set the Group Elements By Schema – Level
Names, you see names (Labels and Roads) instead of
numbers (1 and 2) on the Viewspace window.

Inspecting raster data


Now you’re going to load some raster data into your
Viewer. Then you’ll move the City Parks and the Major
Roads datasets above the Raster data so you can see
them over top of the Raster image. And let’s change the
color of the roads and the parks to make them easier to
see.

Chapter 2: Inspecting Data – FME Universal Viewer 8


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

3. The InteropolisCentre.png dataset now sits on top of 5. The roads are there, but they’re difficult to see. Let’s
the other data you loaded earlier. You’re going to change the color of the roads to white and make the
move these other datasets on top of the raster image. line thicker so the roads are easier to see on the raster
image.
On the Viewspace, drag the globe icon next to the
MAPINFO (city_parks) dataset above the corresponding On the Viewspace, under the DGNV8 (MajorRoads)
globe icon for the PNGRASTER (InteropolisCentre) dataset, click next to Roads.
dataset.
On the Color dialog, click white and then click OK.
Now perform the same step to move the DGNV8
(MajorRoads) dataset above the PNGRASTER Click + next to Roads to open the folder and then
(Interopolis Centre) dataset. double-click Line.

Your Viewer should look similar to the following: At the right of the Drawing Styles dialog, notice that the
Line Style is highlighted. Click in the Thickness field,
which opens the list of choices. Click 2 and then click
OK.

6. Now the roads are easy to see, but you can’t make out
the road names. Let’s set the text to bold.
On the Viewspace, under the DGNV8 (MajorRoads)
dataset, click next to Labels and on the Color dialog,
click black, and then click OK.
Click + next to Labels to open the folder and then
double-click Text to open the Drawing Styles dialog.
At the right side of the dialog under Font, click your
font choice (for example, Tahoma), and then click the
checkbox next to Bold to enable it.
Click OK. You can now see the names of the roads
4. Let’s change the color of the parks. On the Viewspace, easier.
click the city_parks icon . The city parks and the major roads, with their names,
are now overlaid on the raster image. Your View
This action opens the Color dialog, where you click one
window should look similar to the image shown next.
of the green colors and then click OK.
The icon for this dataset and the parks showing over
the raster image are represented in the color you
selected.

Chapter 2: Inspecting Data – FME Universal Viewer 9


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

7. You can save your Viewspace by clicking File > Save


Viewspace.

In the next chapter, you learn how to use FME Universal


Translator to perform quick translations.

Chapter 2: Inspecting Data – FME Universal Viewer 10


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Chapter 3

Quick Translations – FME Universal Translator

In this chapter FME Universal Translator is very useful in situations where


• Objective the schema and geometry of the data do not have to
change during the translation.
• Running a quick translation
• Reprojecting data You can use FME Universal Translator to make minor
adjustments to datasets. However, FME Workbench is the
recommended tool for data manipulation. Chapter 4
Objective provides detailed information about FME Workbench.

In the previous exercise, you used FME Universal Viewer


to inspect data.

In this chapter, you learn how to use FME Universal


Translator to translate data between formats, but with
minimal data transformation.

Chapter 3: Quick Translations – FME Universal Translator 11


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Running a quick translation Note: Some formats require that you specify an
output filename; whereas others, including Shape,
require an output folder.
The quickest way to get data from one format to another
is to use FME Universal Translator. It has a very simple
interface although you don’t have much control over the
translation. FME Universal Translator is used primarily for
uncomplicated translations.

1. To start FME Universal Translator, click Start > All


Programs > FME Universal Translator.

2. Click the Translate button to open the Set Translation


Parameters dialog, shown next.

3. At the Reader location, in the Format field specify


Geography Markup Language (GML).
In the Dataset field, click the Browse button, which
opens the file browser.
Scroll to C:\FMEData\Data\Zones and click zoning.gml.
Click Open to select this file as the Source dataset.

4. At the Writer location, in the Format field specify ESRI


Shape for the output format.
Click the Browse button for the Dataset field.
In the file browser window, navigate to
C:\FMEData\Output\TutorialOutput.
Click Open to select this file as the destination dataset.
5. Click OK to run the translation and then minimize the
Universal Translator – you use it in the next exercise.

Chapter 3: Quick Translations – FME Universal Translator 12


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

6. To verify that the translation gave you the results you


expected, open the TutorialOutput folder using Windows
Explorer.
Right-click the zoning_area.shp file and select View with
FME Viewer.
FME Universal Viewer starts and the Select Dataset to
View dialogs opens, shown next.

7. On the Select Dataset to View dialog click OK to accept


the default parameters and load the Shape file. See the
next figure – your window should look similar to this. Reprojecting data
Notice on the Viewspace window, at the left side of the
This exercise explains how to reproject the zoning.gml file
window, that the name of the destination Shape file is
now zoning_area. without changing its schema or geometry. This type of
translation is one of the most common uses for Universal
The reason for this is because the ESRI Shape format Translator.
(like some others) requires a separate file for each
geometry type. 1. With FME Universal Translator open, click to open
When you write out both areas and points, two sets of the Set Translation Parameters dialog.
Shape files are created. Both of these files have the If Universal Translator was not closed, all settings used
geometry type appended to their name. in the previous exercise remain. If you don’t see the
settings, repeat the steps from the “Running a quick
8. Leave the Shape file open in the Viewer – you use this
translation” exercise on page 12.
information in the next exercise.

Chapter 3: Quick Translations – FME Universal Translator 13


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

2. At the Writer location in the Coordinate System field,


click the Browse button.
The Coordinate System Gallery window opens, shown
next.

4. Click OK to accept this coordinate system.


The Coordinate System Gallery dialog closes and returns
you to the Set Translation Parameters dialog, shown next.
At the Reader location, the Coordinate System field now
reads Read from Source.
Note: In this example, the Coordinate System for the
Reader data shows Read from Source and the
coordinate system is stored as part of the format. This
is not the case for many formats, including most CAD
3. At the bottom of the Coordinate System Gallery window formats.
you see the Show Coordinate Systems location.
The Coordinate System field shows Unknown when
In the contains field type LL-83. reading a format that is not coordinate system-aware.
The Coordinate System Gallery is filtered and shows only If you know the dataset’s coordinate system, you can
those coordinate systems in which the string LL-83 enter it manually by opening the Coordinate System
appears, shown next. Gallery.
If you don’t know the dataset’s coordinate system and
the format is not coordinate system-aware, you cannot
reliably reproject it.

Chapter 3: Quick Translations – FME Universal Translator 14


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

At the Writer location, the Coordinate System field now 7. If the Information tool is not active, click and select
reads LL-83, shown next. a feature.
Look at the Information window. You see that the Coord
Sys field now shows LL83.

You’ve completed the exercises for FME Universal


Translator, and learned how to perform quick translations
and simple reprojections.

The next chapter introduces you to FME Workbench,


where the real power of FME is revealed.

5. Click OK to run the translation.

6. Open the Universal Viewer.


If you performed step 8 in the previous exercise, the
dataset from the previous exercise is still loaded.

Click to refresh the view.


If you have closed the Viewer, reopen the Shape file
using Windows Explorer or by clicking File > Open
Dataset.

Chapter 3: Quick Translations – FME Universal Translator 15


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Chapter 4

Translations – FME Workbench

In this chapter Workbench interface


• Getting started with Workbench
• Basic Workbench tasks
• Intermediate Workbench tasks
• Advanced Workbench tasks

Note: You can also use Workbench to create and use both
custom formats and custom transformers. Those topics
are not described in this tutorial.

Getting started with Workbench


A detailed description of various components used in this
chapter’s exercises is provided next.

This information should help you get familiar with


Workbench, and how to navigate and use it. 1 Menu bar 4 Canvas 6 Log window or
Transformer info

2 Toolbar 5 Transformer 7 Status bar


Gallery
3 Navigator

Chapter 4: Translations – FME Workbench 16


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Menu bar and Toolbar


The menu bar at the top of the Workbench window
contains menus with commands that affect the entire
canvas.

The toolbar is located under the menu bar and provides


tooltips for each icon shown.

Open individual command menus (also called shortcut


menus) by selecting an object on the canvas and then
right-clicking it. These menus are applicable to separate
components.

Adding Tools to the Toolbar


Tools for enhancing the canvas
Certain tools, including Layout tools, are not part of the
default Workbench toolbar. Hover your cursor over a tool to view a short description
of the tool’s purpose, which is called a tooltip.
To access additional tools, right-click a blank spot on the
Toolbar and select Customize Toolbar. ƒ File tools let you start a new
workspace, open a dataset,
From the Edit Toolbar dialog (shown in the next figure) add save, print, and run and stop
a command from the list by clicking it and dragging it onto a translation.
the toolbar.
ƒ Edit tools let you cut, copy,
paste, and undo and redo
changes.

ƒ View tools let you pan, zoom


in and out, and zoom to
extents. You can also turn on
or turn off feature count
display and quick insertions.
Chapter 4: Translations – FME Workbench 17
S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

ƒ Insert tools let you add


source (Reader) and
destination (Writer)
datasets, feature types,
annotations, visualizers, and
bookmarks. They also let you
perform an Auto Layout.
Color definitions
Tools for managing the layout
The Properties button is located on the top right of the
feature types and transformers. This button appears in
different colors, and can have an exclamation point or an
Hover your cursor over a tool to see a tooltip of describing
ellipsis.
its purpose. Layout tools let you do the following:

ƒ Arrange the canvas layout automatically. In most cases, transformers


contain default values that you can
ƒ Select multiple nodes and align the tops, bottoms, use when you run Workbench.
middles, and right or left sides. However, when the Properties
button is red and has an
ƒ Spread nodes horizontally or vertically. exclamation point, one of the
mandatory fields is missing. You
ƒ Expand or collapse (show or hide) the attributes of all
must enter a value before you can
feature types.
run your translation.
Status bar
The area at the bottom left of the Workbench window When the Properties button is
shows progress information, and short descriptions of yellow and shows an ellipsis, the
selected menu items or tools. transformer is using default values
that work, however you should
confirm that they are appropriate.
Workbench elements To do so, click the Properties
When you run Workbench, it reads the feature type button, examine the values on the
Edit Parameters dialog, make any
attributes from the input data. It initially shows the same
changes, and then click OK.
feature types and attributes for the output data. Often you
have something that looks like this:

Chapter 4: Translations – FME Workbench 18


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

When the Properties button is the Creating new attributes


background color and shows an
ellipsis (shown here), you have 1. Create successive new attributes by right-clicking
already saved the value. If you the entire Destination type and then select Add
still want to edit the value, click Attribute.
the Properties button, which opens
The Feature Type Properties dialog opens, shown in
the Edit Parameters dialog where
you make any changes. the figure that follows.

Input arrow is red : The port has no input. For feature


ports, this warning means that no features are coming in.
For attribute ports, the red input arrow indicates that no
values are set. A red input arrow is not considered an
error because there are instances when you may not want
any input to a particular port. However, you normally
want to carefully check red arrows to ensure that any
missing input is intentional.

Input arrow is green : The connection is set.

Output arrow is yellow : You don’t have to connect


the output, but its value is lost when you run Workbench.

Quick changes

Renaming attributes
Move through the tabs by clicking them.
To rename an attribute without opening the Edit Parameters
dialog, do one of the following: 2. Click the User Attributes tab to open that page and
enter new names as appropriate.
• Right-click the attribute name on your canvas and
select Rename. Tab through the fields to accept the default values
and complete the entries.
• Click the attribute name on your canvas and press
F2.

Chapter 4: Translations – FME Workbench 19


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

3. When finished, click OK to show the attributes on Inserting transformer connections


the Workbench canvas as illustrated in the next
figure. Note: When multiple input or output ports are
encountered, the Insert Transformer dialog opens for you to
select the input and output ports you want. You can use
Shift + Click to select a series or ports or Ctrl + Click to
select more than one port.

Method I: Manually Connect


Editing existing attributes
Using this method you manually make all connections
You can edit attribute properties. To open the Edit between the input ports and the output ports.
Parameters dialog where you make any changes, do one of
• Drag a new transformer from the Transformer Gallery
the following:
onto the canvas.
• Right-click an attribute and select Properties.
• Click the Output port from the dataset you’re using
• Double-click an attribute’s Properties button. the Transformer with and drag it to the input port
you’re connecting it to.
Deleting transformer connections
• Click the Transformer’s output port and drag it to
Delete a connection by doing one of the following: the input port you’re connecting to.
• Click the link to select it and, from the menu bar, • The new transformer connections show on the
click Edit > Delete. canvas.
• Click the link and press the Delete key.
• Right-click the link and click Delete.

Selecting multiple connections


To select more than one link, do one of the following:
• Hold down the Ctrl key, click each successive link Method II: Drag and Insert
until you’ve selected the links you want, and then You can connect a transformer quickly by dragging it into
release the Ctrl key. place on the canvas and releasing it. This method is useful
• Hold the left mouse button down, drag the cursor when you’re using a relatively simple workspace, and
in a box around an area, and release the mouse require efficiency and speed.
button. All connections in the boxed area are
selected.

Chapter 4: Translations – FME Workbench 20


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

only those transformers that match what you’ve typed


so far.
• When you see the transformer you want, either
click it or press the Enter key to place this
Note: For more information on Quick Insertions see Using transformer on your canvas.
transformers, specifically step 3 on page 25.
Quick Add is integrated with Drag and Insert and with
Quick Connect. If a connection is already selected on your
Method III: Quick Connect
canvas, when you place a transformer using Quick Add,
This method makes it easier to connect two ports when that transformer is inserted into the connection.
you’re working in large workspaces and faster to connect
from a single port to multiple ports. Likewise, if a port is already selected on the canvas, then
the new transformer added with Quick Add is inserted or
attached onto all connections on that port.

Inserting vertices on links


To route your connections around other areas on the
canvas, right-click a connection and select Insert Vertex on
Link.

Alternatively, double-click the connection where you want


to create a new vertex.
Method IV: Quick Add
Quick Add is a search dialog on your canvas that
replicates the work of the Transformer Gallery search
window. You can add transformers to a workspace without
having to search for them in the Transformer Gallery. This
method makes placing transformers fast.
• To use quick add, click in a blank area of your
canvas and press a key on the keyboard; for
example, a.
As you type another letter, a list of transformers with
names that match the content start to show. The more
letters you type, the more the list is filtered to show

Chapter 4: Translations – FME Workbench 21


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

You can use the links under Actions to start working


with workspaces. For this exercise, click Open the
Basic Workbench tasks workspace dialog.

The tools introduced in chapter 2 and 3 provide a quick Under Recent Files, you see a list of the most recently
way to perform simple translations. However, when the opened workspace files.
schema or the geometry of the data changes, it’s best to
To stop this page from showing when you start
use Workbench to perform the translations. Workbench, clear the checkbox for Show the dialog on
startup, which is located at the bottom of the startup
This exercise uses Workbench to do the following:
page.
• Creating a translation (workspace)
For users who have chosen not to show the startup
• Using transformers page, when you start Workbench you see a blank
workspace. Open the startup page (at any time) by
Creating a translation (workspace) clicking File > New.

3. The New Workspace dialog is where you choose the


1. Start FME Workbench. source dataset’s Reader format and dataset, and the
destination dataset’s Writer format and dataset.
2. The startup page opens, shown next.
In the Reader Format field open the list and select
MapInfo MIF/MID for the source dataset’s Reader
format.

Chapter 4: Translations – FME Workbench 22


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

In the Dataset field click the Browse button to open the 5. Save your workspace and name it parcels.fmw.
file browser.
Your workspace should look similar to the following
Browse to the C:\FMEData\Data\Properties folder and figure. (In our example, the width of the Navigator was
double-click the parcel_L26.mif file to make this increased to show the full pathnames for the published
selection, close this dialog, and return to the New parameters.)
Workspace dialog.

4. At the Writer location, in the Format field, select Google


Earth KML. Remember, for a quick search, type kml to
show only those entries with those letters.
You can set the Writer dataset now, instead of waiting
until later. In the Dataset field, browse to the
C:\FMEData\Output\DemoOutput folder and name this file
parcels.kml. Click Save.

Your source dataset is shown under the heading


Reader Feature Types. The area called the Data Flow
shows what transpires between these feature types.
And you see your destination dataset under the
heading Writer Feature Types.

Inspecting your data


1. On your canvas, right-click the source dataset under
Reader Feature Type and select Visualize.
The Viewer opens showing the Select Dataset to View
dialog. Notice that the fields are populated.
Click OK to see the source dataset.
Zoom in (several times) to see an image with points
and line features, similar to the following image.
Click OK to close the New Workspace dialog and
generate a workspace.

Chapter 4: Translations – FME Workbench 23


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Filtering the Geometry


1. If it’s not already showing in Workbench, open the
parcels.fmw workspace you saved in the previous
exercise.

2. The Transformer Gallery is on the Navigator. At the


bottom of the gallery is a Search field.

Click in this field and type filter and press Enter to filter
the transformers and show the Search Results in the
Transformer Gallery.

From the Search Results list, find and drag the


GeometryFilter transformer onto your canvas, which
should look similar to the following image.

Minimize the Viewer because you’ll use it again.

Using transformers
Now that you have created a basic workspace, you can
begin manipulating the data.

Transformers are tools used to manipulate the geometry


or attributes of data. They are connected in a series –
data flows from the source to the destination, applying
transformer processes at each step.

When you inspected the data, you saw the MapInfo


MIF/MID lines and points. In this next exercise, you want
just the lines, so you’ll filter the geometry. You’ll also
create polygon features from the lines, transform the data
model, and set the symbology for the data output.

The following instructions continue with the example


you’ve been working with.

Chapter 4: Translations – FME Workbench 24


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

3. You can connect this transformer to the source and For this exercise, select GeometryFilter : LINE and click
destination feature types in several ways, described OK.
earlier under the heading “Inserting transformer
The GeometryFilter is placed successfully between the
connections” on page 20. The instructions that follow
Reader and Writer feature types, and the LINE output
describe the Quick Insertion method.
port is connected to the Writer feature types, shown
Note: Make sure Workbench has the Enable/Disable next.
Drag and Insert Transformer feature enabled by clicking
on the Workbench toolbar. If it isn’t enabled, you
won’t see the pink dots and lines described in the
following steps. You can enable or discontinue quick
insertions at any time by clicking .
You can drop a transformer into place between two
previously connected feature types or transformers.
This time-saving feature lets you quickly place a
transformer without having to delete the existing
feature connection.
Click the GeometryFilter transformer on the canvas and
start dragging it upward. Notice the pink dot that
shows in the top left corner.
Keep dragging the transformer onto the feature
connection between the existing feature types. Release
the mouse button to drop the transformer into place. 4. The Properties button on the GeometryFilter is yellow,
which indicates the default values will be used, which
Because this transformer has multiple output ports, is fine for this exercise.
the Insert Transformer dialog, shown next, opens.
5. You’ll now add two more transformers. Let’s start by
adding an AreaBuilder transformer to turn the lines
into polygons.
Click on a blank area of your canvas.

Chapter 4: Translations – FME Workbench 25


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Start typing build and the Quick Add dialog opens,


shown next.

Click AreaBuilder and to instantly place the transformer


on your canvas.
On the canvas, drag the AreaBuilder over the
connection between the GeometryFilter transformer
and the destination feature type under Writer Feature
Types until that connection is highlighted.
Release the mouse, which opens the Insert 7. You’re going to change the parameters of the
Transformer dialog. Select AreaBuilder : AREA and click KMLStyler transformer, so click the Properties button
OK. on that transformer.

6. Now let’s add a KMLStyler transformer to set the 8. On the KMLStyler Parameters dialog, shown next, you
polygon’s symbology, using a combination of Quick want to set the fill color. In the Color location, at the
Add and Insert functionalities. Fill Color field, click the Browse button.
On your canvas click the connection between the On the Select Color dialog, click the color red and click
AreaBuilder transformer and the destination feature OK.
type under Writer Feature Types, and start typing kml.
On the Quick Add dialog, select KMLStyler. The
transformer now is connected between the AreaBuilder
transformer and the destination feature type under
Writer Feature Types.
Your workspace should look similar to the following
image. (The objects were moved around to make it
easier to read what was on the canvas.)

Chapter 4: Translations – FME Workbench 26


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Click OK to make this change

10. Click the Run button to run the workspace.


If you didn’t specify the output directory for your
Click OK to make this change and to close the
destination (Writer) dataset previously, you have to do
KMLStyler Parameters dialog.
so now. See “Creating a translation (workspace)”,
9. Click the Properties button on the destination feature specifically step 4 on page 23.
type under Writer Feature Types to open the Feature If prompted, click the Browse button and browse to
Type Properties dialog. C:\FMEData\Output\DemoOutput.
In the Name Parameters location, in the Feature Type
Name field enter LotParcels, as shown next.

Chapter 4: Translations – FME Workbench 27


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Your canvas should look similar to the one shown next.

12. Minimize the Viewer.


It’s time to inspect the data.

11. On the canvas, right-click the destination feature type Intermediate Workbench tasks
under Writer Feature Types and select Visualize. On the
Select Dataset to View dialog, click OK to open this This exercise continues with the same workspace used in
dataset in the Viewer.
the Basic Workbench tasks.
The Viewer opens the destination dataset, which
should look similar to that shown in the next figure.
Processing multiple files
Notice that the line features from the original data are
replaced with polygon (area) features because of the 1. On the Navigator locate the source dataset (Source
action of the AreaBuilder transformer. MapInfo MIF/MID File) and double-click it to open the
Edit Published Parameter dialog, shown next.

Chapter 4: Translations – FME Workbench 28


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

2. Click Browse and select parcel_L26 through parcel_L29, Your dialog should look similar to the following image.
shown next.

Click OK.
Click Open to make the selection and to place this new
source dataset on the canvas.
4. Click to run the workspace.
Click OK to accept the list of selected feature types.
On the canvas, notice that the name of this dataset
3. Data that doesn’t have a matching feature type is has changed, shown next.
discarded. Therefore to accommodate L27, L28, and
L29 when only L26 is defined, you’ll set the merge
options.
Click the Properties button on the Reader feature type.
On the Feature Type Properties dialog at the Merge
Parameters location, click the checkbox in front of
Merge Feature Type to enable it.
In the Merge Filter field, type * meaning that you want
to let everything pass.

Chapter 4: Translations – FME Workbench 29


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Advanced Workbench tasks


Now you’re going to add EPA monitored sites to your
workspace. This exercise continues from where the
Intermediate tasks left off and uses Workbench to do the
following:
• Adding a new reader to your workspace
• Spatially Filtering the Data

Adding a new reader to your


workspace
1. With the workspace from the previous exercise open,
5. Using Viewer or Google Earth, refresh the data and on the menu bar click Readers > Add Reader to open
notice that you’ve processed four tiles of data. Also the Add Reader dialog.
notice that number of features is now 3637, shown
next. In the Format field, type gml and select GML
(Geography Markup Language) as your source dataset.
In the Dataset field, browse to C:\FMEData\Data\EPA and
select EPAMonitoredFacilities.gml. The Add Reader
dialog should look similar to the following:

Click OK.

Chapter 4: Translations – FME Workbench 30


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

2. On the Select Feature Types dialog that opens, you’ll see Spatially Filtering the Data
a list of the different ways the data was captured and
put on different feature types. Now you’re going to add a Bufferer transformer to put a
Clear all checkboxes except House Address. 1000 foot buffer zone around the EPA sites. You’ll also add
a SpatialFilter transformer to identify properties within this
At the bottom of the dialog click the checkbox titled 1000 foot buffer.
Add also to writer. The Select Feature Types dialog should
look similar to the following: 1. On your workspace, use the Quick Add method to add
a Bufferer transformer to the canvas.
Open the Bufferer Parameters dialog and set the Buffer
Amount to 1000, shown next.

Click OK.

3. Drag the House Address reader you just created down Click OK.
the canvas. You can also rearrange the other objects
2. Next add a SpatialFilter transformer.
so it’s easier to see them.
On the SpatialFilter Parameters dialog, set the following
properties (shown next):
• Tests are INTERSECTS and WITHIN.
• Pass Criteria is Pass Against One Base.

Chapter 4: Translations – FME Workbench 31


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

Your workspace should look similar to the following:

4. Click to run the workspace.


You may see an Unexpected Input dialog. Earlier FME
Workbench was instructed not to read certain layers in
3. On your canvas, make the following connections:
the EPA dataset. Therefore, it’s fine to ignore this
Connect the output port from KMLStyler to the reminder by clicking OK.
Candidate input port on the SpatialFilter.
5. Save your workspace.
Connect the output port on the Bufferer transformer to
the BASE input port on the SpatialFilter. Google Earth was used to open the resulting
destination dataset, which looks like the following
Leave the existing connection to the destination image.
dataset so you can see the buffers in the destination
dataset later. The areas we created polygons for are shown in red.

On the canvas, connect the SpatialFilter PASSED The white circles indicate the EPA buffer zones we set.
output port to the LotParcels destination dataset’s
input port.
Delete the connection between the KMLStyler STYLED
output port and the LotParcels destination dataset.

Chapter 4: Translations – FME Workbench 32


S a f e S o f t w a r e I n c . F M E D e s k t o p T u t o r i a l

You’ve now completed Chapter 4. And you’ve completed


the tutorial. You worked through a good cross-section of
Workbench’s functionality. You’ve seen the usefulness of
the Viewer for both inspecting data and taking snapshots
of workspaces.

FME products feature a multitude of formats and


transformers. The basics you’ve acquired in this tutorial
should prove useful for successfully managing your data
translation needs.

The following resources are helpful for learning more


about Safe Software and its products:
• Online learning information
Not all EPA buffer zones have polygons in them
because we didn’t create parcels for all of them. • fme user central
Remember we used only 4 parcels earlier in step 2
under the heading “Processing multiple files”.
Note: If you want to attempt it, you can read all of the
parcel files, not just four of them, to get a wider set of
results.

Chapter 4: Translations – FME Workbench 33

Potrebbero piacerti anche