Exercise 2 Data Download System: Format and Coordinate Systems
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:\FMEData2018\Workspaces\ServerAuthoring\SelfServe2-Ex2-Begin.fmw
End Workspace C:\FMEData2018\Workspaces\ServerAuthoring\SelfServe2-Ex2-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, 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 1, 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 the format and coordinate system.


2) Add Writer
To give control over format you need a Generic format writer. Select Writers > Add Writer from the menubar. When prompted enter these parameters:

Writer Format Generic (Any Format)
Writer Dataset C:\FMEData2018\Output
Writer Parameters Output Format: JPEG (Joint Photographic Experts Group)
MIME Type: image/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 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 labeled with the same name, so be sure to inspect their properties to check if you need to. You could (should?) also add an annotation to each, to tell them apart.

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 Create User Parameter.

Set the parameter values as follows:

TypeChoice with Alias
NameOutputFormat
PublishedYes
OptionalNo
PromptSelect 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 that 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 anymore and, since it is used nowhere else, will remove it.

*NB: If you didn't set a default value for the OutputFormat user parameter, then the Generic writer parameter will turn red (flagged as incomplete). This is nothing to worry about. It will be set at runtime.*


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 Create User Parameter.

Set the parameter values as follows:

TypeChoice with Alias
NameOutputCoordSys
PublishedYes
OptionalNo
PromptSelect 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 that we've created 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 set the writer to "Output [GENERIC]" (not "Output [JPEG]").

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 anymore, 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:
  • Add a Generic Writer and set up its format and MIME type parameters
  • Create an output format user parameter and apply it to a Generic Writer
  • Create an output coordinate system user parameter and apply it to a Generic Writer
  • Apply a parameter from a dummy Writer to the generic Writer

results matching ""

    No results matching ""