Exercise 5.1 | Data Download System: Published Parameters |
Data | Orthophoto images (GeoTIFF) |
Overall Goal | Create an FME Server Data Download system for orthophotos |
Demonstrates | Creating published parameters for user control in Data Download |
Start Workspace | C:\FMEData2018\Workspaces\ServerAuthoring\SelfServe2-Ex1-Begin.fmw |
End Workspace | C:\FMEData2018\Workspaces\ServerAuthoring\SelfServe2-Ex1-Complete.fmw |
As a technical analyst in the GIS department of a city, you have just commenced an initiative to allow other departments to download orthophoto data, rather than having to ask you to create it for them. Not only will their requests be processed quicker, but you will also spend less time on that task.
So far you have created a simple workspace to translate orthophotos to JPEG format, and published it to a Data Download service on FME Server.
Now you need to start customizing the workspace to allow the end-users to have a degree of control over the output.
1) Open Workspace
Open the starting workspace listed above. You can see that it consists of a reader, a writer, and two transformers.
In this step, we'll give the end-user control over the transformation stages.
2) Create User Parameter
If you look at the parameters for the RasterResampler transformer, you'll see parameters for X Cell Spacing and Y Cell Spacing. We should let the end user choose what spacing they want.
So, in the Navigator window of FME Workbench, locate the section marked User Parameters. Right-click on there and choose the option Create User Parameter:
The dialog that opens allows us to create a new parameter. Create one using the following parameters:
Type | Number |
Name | CellSpacing |
Published | Yes |
Optional | No |
Prompt | Enter Resolution (1-50) |
Configuration | Lower Limit: Greater than value: 0 Upper Limit: Less than value: 51 Decimal places of precision: 0 |
Default Value | 50 |
Click OK to close the dialog.
3) Apply User Parameter
Currently we've created a user parameter, but not applied it to anywhere.
Inspect the parameters for the RasterResampler transformer. Click the drop-down arrow to the right of the X Cell Spacing parameter, and choose User Parameter > CellSpacing.
Do the same for the Y Cell Spacing parameter. The dialog will now look like this:
Notice that we're using the same values for the X and Y cell sizes. That's OK. Although we could use rectangular (oblong) raster cells, for this exercise we'll stick with a square.
4) Create User Parameter
Another setting we might give control of to the user is file compression. This is not defined in a transformer, but in the writer feature type. However, we can still create a published parameter in the same way.
So, right-click on User Parameters in the Navigator window and choose Add Parameter again.
This time we'll do this a little bit differently. Compression can be a value from zero to one hundred, but we'll present the user with the choice of None, Low, Medium, and High.
So create a parameter with the following:
Type | Choice with Alias |
Name | Compression |
Published | Yes |
Optional | No |
Prompt | Select Compression Level |
For the configuration field, click the [...] browse button. In the dialog that opens, set the following:
Display Name | Value |
---|---|
None | 0 |
Low | 25 |
Medium | 50 |
High | 75 |
Click OK and OK again to close these dialogs and create the parameter.
5) Apply User Parameter
To apply the parameter, inspect the parameters for the JPEG feature type. Expand the Compression parameters (if necessary) and set the Compression Level parameter to User Parameter > Compression.
Click OK to close the dialog. If you press the run button now - with the prompt option set - you'll see that there are now two new prompts for cell size and compression.
6) Publish and Run Workspace
Now publish the workspace to FME Server. Publish it to the Training repository and then register it with the Data Download service.
Locate the workspace through the FME Server web interface and run it. This time you will be prompted to set the cell size and compression.
Run the workspace a few times, varying the cell size and compression, to confirm that the parameters are having an effect. The size of the output file is a good indicator that the process is working correctly.
CONGRATULATIONS |
By completing this exercise you have learned how to:
|