FME Version
Files
Introduction
In part 2 , you learned how to publish a workspace to FME Server and run it from the Web User Interface. Now, in part 3, you will modify that workspace, so it allows for “self-serve” data access. This will be accomplished by creating published parameters in FME Workbench, publishing the workspace to FME Server, and seeing how to interact with the published parameters.
Note: In Step 3 there are slightly different instructions if you are following this tutorial with FME Desktop 2021.0 or newer. The concepts are still the same but the interface is different because of the addition of the Parameter Manager. If you are following this tutorial with FME Desktop 2020.2 or older, the instructions are below the 2021.0 section.
Video
In part 3 of this tutorial, you'll learn how to enable an FME Workspace for self-serve data access so anyone can download your data. This involves creating published parameters in FME Workbench, publishing the workspace to FME Server, and running the workspace from the Web User Interface. Please note that this video was created with FME Server 2019.0, the interface may vary in other versions of FME.
Step-by-Step Instructions
1. Open FME Workbench
Open the workspace from part 2 in FME Workbench. Alternatively, open the template attached to this article (CommunityMapping.fmwt) in FME Workbench.
On the Generic Writer, the default writer format is set to Esri Shapefile. But, the goal is for the user to select the format of their choice, from a small list, at run time. This is accomplished with published parameters.
Parameters in FME control how FME operates. They exist in many places, such as readers, writers, and transformers.
2. Open the Generic Writer Published Parameters
In the Navigator window, expand the GENERIC Writer by clicking the arrow to the left of it, then expand Parameters.
Double-click the Output Format parameter, this shows that it’s been set up so the user can select from any format in the formats gallery.
But that’s not what we want. The goal is to present the user with a list of 4 common formats. So, we will create a new user parameter and define it accordingly.
3. Create New User Parameter
FME Desktop 2021.0 or newer:
In the Navigator window, right-click on User Parameters and select Manage User Parameters.
Click on the Green plus sign then select Choice.
On the right-hand side fill in the following parameter properties:
Parameter Identifier: Output_Format
Prompt: Enter an output format
Published: Enabled
Required: Disabled
Disable Attribute Assignment: Enabled
Choice Configuration: Drop-down
Then for Choices enter the following:
Value | Display |
SHAPEFILE | Esri Shapefile |
MITAB | MapInfo TAB |
GML | GML |
Then select Esri Shapefile as the default value and click OK.
In FME Desktop 2020.2 or older:
In the Navigator window, right-click on User Parameters and select Create User Parameter.
In the Add/Edit User Parameter dialog, enter the following parameters:
Type: Choice with Alias
Name: Output_Format
Prompt: Enter an output format:
Published: Checked
Optional: Checked
Next, click the ellipsis button for Configuration and we are going to import the formats we want the user to use.
In the Edit Choice with Display Name dialog, click on Import, then Writer Formats. From here we will import the writer formats we want to use.
Search and select Esri Shapefile, GML, Bentley Microstation Design V8, and MapInfo TAB (MITAB). Click OK, and OK again.
Back in the Add/Edit Parameter dialog, select Esri Shapefile for the default value. The completed parameter should look like this:
4. Link Published Parameter to Output Format Parameter
Our new Output_Format parameter appears under User Parameters > Published Parameters, but we still have to link it to the Generic Writer’s Output Format parameter. Locate the Output [GENERIC] Writer, and expand it with the arrow to view the Parameters, the first one being Output Format. Right-click on Output Format, select Link to User Parameter.
Select the new Output_Format parameter we just created.
5. Run the workspace
If you run the workspace immediately, it will use the default value and output Esri Shapefile. However, if you select Prompt for User Parameters then click Run, you will be prompted to choose the output format. Notice only those four formats are presented now in the drop-down list. Pick GML. The workspace runs successfully.
6. Publish Features Types to Read Parameter
Now let’s set up the workspace so the user gets to choose which feature types they want to request.
In the Navigator, expand the CommunityMap [FILEGDB] File Geodatabase Reader > Parameters > and double click Features to Read. This parameter lets the user decide which feature types to process when the workspace runs. Close the dialogue.
Right-click on Feature Types to Read parameter and select Create User Parameter. Go with the defaults for the definition, and click OK. Confirm the new parameter appears under Published Parameters.
7. Run Workspace Again
Ensure that Prompt for User Parameters is still enabled and rerun the workspace.
Notice that this time there are two parameters to set. Set it to whatever parameters you wish, and then click Run. Confirm that the workspace runs correctly.
8. Publish to FME Server
Now that we have the parameters set up and confirmed that the workspace runs correctly, we can publish it to FME Server.
Before publishing, save the workspace. Once saved, go to File > Publish to FME Server on the top menu bar.
Connect to the same connection as the previous tutorial. Select the Server Tutorial repository that we also created in the previous tutorial. We will keep the workspace name CommunityMapping.fmw and just overwrite the previously uploaded workspace.
Note: If you did not complete the previous tutorial, go back to the tutorial and follow the instructions in Step 3 to learn how to publish a workspace to FME Server.
8. Open the FME Server Web User Interface
Open and log into the FME Server Web User Interface. If this is your first time logging into FME Server, please see the instructions in Tutorial: Getting Started with FME Server to learn how to do this.
9. Run Workspace
On the side menu bar in FME Server, click on Run Workspace. On the Run Workspace page, select Server Tutorial for the Repository and the CommunityMapping workspace. Select Data Download for the Service.
Check out the Published Parameters. The two parameters that were set up and just tested in FME Workbench are shown. Just as before, select an output format, and select one or more feature types.
Once you have selected the parameters, click Run.
10. View the Results
The Data Download service presents a URL link to the translation results in a zip file. A quick inspection of the contents of the zip file confirms the results are what we expected.
Additional Resources
Running and Configuring a Workspace
FME Server Troubleshooting Guide
Data Attribution
The data used here originates from open data made available by the City of Vancouver , British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.