Exercise 1.1 | Daily Database Updates: Publishing a Workspace |
Data | FireHalls (GML) Neighborhoods (KML) |
Overall Goal | Create a workspace to read and process departmental data and publish it to FME Server |
Demonstrates | Publishing a workspace to FME Server |
Start Workspace | None |
End Workspace | C:\FMEData2018\Workspaces\ServerAuthoring\Basics-Ex1-Complete.fmw |
For the exercises in this chapter, you are a technical analyst in the GIS department of your local city. You have plenty of experience using FME Desktop, and your department is now investigating FME Server to evaluate its capabilities.
There are many departments within the city, and one of your tasks is to take the data from each department and merge it together into a single, corporate database.
Because each department produces their datasets in a different format and style, you use FME for this task and carry it out on a weekly basis.
One of the reasons for purchasing FME Server is to automate this procedure, so let's start implementing that.
Police Chief Webb-Mapp says... |
If you have lots of experience with FME Workbench - and if your instructor agrees - simply open the workspace listed in the header above and skip to step 8. |
1) Inspect Source Data
For the sake of simplicity - and because this course is about FME Server, not FME Desktop - we will just use a couple of datasets. These are:
Reader Format | GML (Geography Markup Language) |
Reader Dataset | C:\FMEData2018\Data\Emergency\FireHalls.gml |
Reader Format | Google KML |
Reader Dataset | C:\FMEData2018\Data\Boundaries\VancouverNeighborhoods.kml |
Start the FME Data Inspector by selecting it from the Windows start menu. Inspect all of the source data to become familiar with it. The VancouverNeighborhoods has a different coordinate system than the other dataset so be careful and turn on a background map if you want to view all the data together.
The goal of our translation is to convert the FireHalls and Neighborhoods to a database, dividing the firehall data into a separate table per neighborhood.
2) Start FME Workbench
Start FME Workbench by selecting it from the Windows start menu. On a blank canvas, select Readers > Add Reader to start adding a reader to the workspace. When prompted, enter the following details for the FireHalls dataset:
Reader Format | GML (Geography Markup Language) |
Reader Dataset | C:\FMEData2018\Data\Emergency\FireHalls.gml |
3) Add KML Data
Now repeat the process one more time to add a reader for the KML dataset:
Reader Format | Google KML |
Reader Dataset | C:\FMEData2018\Data\Boundaries\VancouverNeighborhoods.kml |
While adding the KML dataset, you'll be prompted to choose which Feature Types (layers) to add to the workspace. The only one we need is called Neighborhoods:
You should now have two readers on the canvas:
4) Add Reprojector Transformer
Add a Reprojector transformer to the workspace. You can do this by simply clicking on the canvas and starting to type Reprojector. Connect it to the Neighborhoods feature type:
In the Reprojector's parameters set the Destination Coordinate System to UTM83-10:
This will ensure the neighborhoods data is in the same coordinate system as the rest of the data.
5) Add Writer
Now we should add a writer to the workspace. For now, we'll just set up a dummy writer until we are more familiar with FME Server. So select Writers > Add Writer on the menu bar to add a writer and set it up with the following parameters:
Writer Format | NULL (Nothing) |
Feature Class or Table Definition | Copy from Reader... |
Click OK. When prompted, select both FireHalls and Neighborhoods as the feature types to add and OK again:
The workspace will now look like this:
6) Add Clipper Transformer
Add a Clipper transformer to the workspace. This will be used to divide the FireHall data by Neighborhood.
Connect the FireHalls feature type to the Clipper:Clippee port and the Reprojector:Reprojected output to the Clipper:Clipper port. You may wish to rearrange the feature types (or the port order) to avoid overlapping connections
Check the parameters for the Clipper transformer to ensure the Clipper Type is set to Multiple Clippers. That's because there are multiple neighborhood features to act as a clipper feature.
Enable Merge Attributes, so that the neighborhood name is copied from the Neighborhood features to the FireHall features:
Connect the Clipper:Inside port to the FireHalls writer feature type. Also make a connection from the Reprojector:Reprojected port to the Neighborhoods writer feature type:
7) Set Firehall Feature Type Name
Finally, let's set the Feature Type Name for the FireHalls writer feature type.
Inspect its parameters and under Feature Type Name either enter:
FireHalls-@Value(NeighborhoodName)
...or click the dropdown and use the text editor dialog to enter that value. This will cause firehalls in each different neighborhood to be written to a different table/layer.
8) Run Workspace
Here comes the Server part of the process.
First, save the workspace. It is always a good idea to save the workspace before publishing to FME Server. Next, run the workspace. If the workspace won't run on FME Desktop, then it is not likely to run on FME Server.
Once the workspace has been run, inspect the translation log. Your translation log should look like the one below:
9) Publish to Server: Create Connection
Now we have a workspace and know that it works correctly, let's publish it to FME Server.
In FME Workbench, choose File > Publish to FME Server from the menubar. As this is the first time we've connected to our FME Server, we'll need to create a new connection, so in the Publish to FME Server wizard select Add Web Connection from the drop-down menu.
In the dialog that opens enter the parameters provided by your training instructor. In most cases the parameters will be as follows:
- FME Server URL: http://localhost
- Username: admin
- Password: admin
You may or may not (probably not) need to enter a port number with the hostname, depending on how the system is set up.
Click Authenticate to confirm the connection and return to the previous dialog. Make sure the newly defined connection is selected and click Next to continue.
10) Publish to Server: Repository Selection
The next dialog prompts you to choose a repository in which to store the workspace.
For this exercise, we’ll create a new repository by clicking the New button. When prompted enter the name Training.
Click OK to close the Create New Repository dialog. Enter a name for the workspace if it doesn't already have one. Place a checkmark against the Upload Data Files option:
Then click Next to continue the wizard.
11) Publish to Server: Select Service
In the final screen of the wizard we can register the workspace for use with various services.
Select the Job Submitter service as this is the only service we are using for now:
... and click Publish to complete publishing the workspace.
After a workspace is transferred to Server, the log window displays a message reporting which workspace has been published to which repository and for which services. It will look something like this:
CONGRATULATIONS |
By completing this exercise you have learned how to:
|