Exercise 2 | |
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:\FMEData2016\Workspaces\ServerAuthoring\SelfServe-Ex2-Begin.fmw |
End Workspace | C:\FMEData2016\Workspaces\ServerAuthoring\SelfServe-Ex2-Complete.fmw |
As a technical analyst in the GIS department of a city you have just commenced a project 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, 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 workspace from exercise 1, or 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 Add Parameter:
The dialog that opens allows us to create a new parameter. Create one using the following parameters:
Type | Integer |
Name | CellSpacing |
Published | Yes |
Optional | No |
Prompt | Enter Resolution (1-50) |
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.
Open the parameters dialog 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 raster cells, for this exercise we'll stick with 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, click the cogwheel button for the JPEG feature type to open its properties dialog. Click the Format Parameters tab. Set the compression 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 again. As before, 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.
CONGRATULATIONS |
By completing this exercise you have learned how to:
|