Exercise 3 | |
Data | Orthophoto images (GeoTIFF) |
Overall Goal | Create an FME Server Data Download system for orthophotos |
Demonstrates | Controlling output format and coordinate system in Data Download |
Start Workspace | C:\FMEData2016\Workspaces\ServerAuthoring\SelfServe-Ex3-Begin.fmw |
End Workspace | C:\FMEData2016\Workspaces\ServerAuthoring\SelfServe-Ex3-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, added published parameters for transformation, and published it to a Data Download service on FME Server.
Now you need to give the end-users control over the output format and output coordinate system.
1) Open Workspace
Open the workspace from exercise 2, or the begin workspace listed above. You can see that it consists of a Reader, a Writer, and two transformers, plus some published parameters.
In this step we'll give the end-user control over format and coordinate system.
2) Add Writer
To give control over format needs a Generic format writer. Select Writers > Add Writer from the menubar. When prompted enter these parameters:
Writer Format | Generic (Any Format) |
Writer Dataset | C:\FMEData2016\Output |
Writer Parameters | Output Format: JPEG (Joint Photographic Experts Group) MIME Type: img/jpeg |
Add Feature Types | Copy From Reader |
The MIME type setting doesn't apply for a Data Download service, but we'll set it anyway. It can't hurt. Your workspace will now look like this:
The upper (unconnected) feature type belongs to the Generic Writer.
3) Switch Feature Types
We want to write to the Generic Writer, not the JPEG Writer, so switch the connection from the JPEG feature type to the Generic feature type. They are both labelled "GEOTIFF" so be sure to open the properties dialog to check if you need to.
Don't delete the JPEG Writer though, or its feature type. We'll need those for reasons to be explained shortly.
4) Create User Parameter
To give control over format requires a published parameter. So in the Navigator window of FME Workbench, locate the section marked User Parameters. Right-click on there and choose the option Add Parameter.
Set the parameter values as follows:
Type | Choice with Alias |
Name | OutputFormat |
Published | Yes |
Optional | No |
Prompt | Select the Output Format |
For the configuration field, click the [...] browse button. In the dialog that opens, click on Import > Writer Format(s):
This will open a list of FME-supported formats. Choose a few simple raster formats such as JPEG, PNG, and GeoTIFF. Click OK to close the dialog and return to the previous one:
WARNING |
Be sure to use the PNG format called PNGRASTER. Don't select the format called PNG Rasterizer (PNG) as that is for rasterizing vector data, not writing raster data. |
Click OK and OK again to close these dialogs and create the parameter.
5) Apply User Parameter
Now we've created a user parameter, we have to apply it.
Locate the Generic Writer in the Navigator window, expand its parameters and locate the parameter called Output Format. This is already linked to a published parameter that FME created automatically, but we want to ignore that and use our own.
So, right-click on Output Format and choose the option to Link to User Parameter:
When prompted select the OutputFormat parameter that we just created:
The parameter FME created (GENERIC_OUT_FORMAT_GENERIC) will be automatically deleted. FME realizes that we don't need it any more and, since it is used nowhere else, will remove it.
6) Create User Parameter
The next parameter required is to give control over output coordinate system. The process is very similar to that of format. In the Navigator window of FME Workbench, locate the section marked User Parameters. Right-click on there and choose the option Add Parameter.
Set the parameter values as follows:
Type | Choice with Alias |
Name | OutputCoordSys |
Published | Yes |
Optional | No |
Prompt | Select the Output Coordinate System |
For the configuration field, click the [...] browse button. In the dialog that opens, click on Import > Coordinate System(s). This opens a list of FME coordinate systems. Choose a few simple systems that will apply to this part of Canada, such as LL84, BCALB-83, and UTM83-10.
Click OK to close the dialog and return to the previous one:
Click OK and OK again to close these dialogs and create the parameter.
7) Apply User Parameter
Once more, now we've create a user parameter, we have to apply it.
Locate the Generic Writer in the Navigator window, and this time look for the parameter called Coordinate System:
Right-click on this parameter and choose Link to User Parameter. When prompted, select the published parameter called OutputCoordSys that we just created.
If you now use the Run button in Workbench you'll see that both these parameters are now published.
8) Publish to FME Server
Save the workspace and publish it to FME Server. However! When you register it with the Data Download service be sure to click the Edit button to edit the service properties. In that dialog you MUST change the writer from "Output [JPEG]" to "Output [GENERIC]".
If you don't do that, then the Data Download will consist of the output of the JPEG Writer. Since that is not connected, there will be no output and so no zip file!
Once published locate the workspace in the FME Server web interface and run it.
Choose different options for output format and coordinate system to see what happens in the output.
Professor Spatial F.M.E., E.T.L. says... |
Right now I imagine you have some questions!
Q) Why didn't we delete the original JPEG Writer when we added the Generic Writer? A) It's because we have a parameter published for JPEG compression. If we deleted the JPEG Writer we would no longer have access to that parameter. Q) But we're not even using the JPEG Writer any more, so how would that parameter work? A) Because the Generic Writer picks up parameters for the format it is writing from any Writer of that format! So you could add a dummy PNG format Writer and the Generic Writer would use the dummy's parameters when writing PNG. |
CONGRATULATIONS |
By completing this exercise you have learned how to:
|