FME Version
Introduction
FME Flow (formerly FME Server) can create Workspace Apps, which allow a user to run the workspace in an app format in a web browser. This article has three different examples of FME Flow Workspace Apps. See Getting Started with FME Flow Workspace Apps for full instructions on Workspace Apps.
Creating an FME Flow Workspace App
To create an FME Flow App, log into FME Flow. On the side menu bar, expand Flow Apps then select Create Workspace App. In FME 2022.2 or older, expand Server Apps, then select Create (Workspace) App. Then set up the app with the details provided for each demo.
For detailed step-by-step instructions on creating FME Flow Apps, see Getting Started with FME Flow Workspace Apps.
FME Flow Workspace App Examples
Easy Translator
Live Demo
This FME Flow Workspace App uses the easyTranslator.fmw workspace that is included with FME Flow. This app can be used to translate data from and to any FME supported format. FME's generic reader can "guess" at the format from the extension and we use the FME Flow Data Steaming service to return the output data to the user.
Step-by-step Instructions
1. Create FME Flow Workspace App
Create an FME Flow Workspace App following the instructions in the Creating an FME Flow App using the following parameters:
- App Name: EasyTranslator
- Repository: Samples
- Workspace: easyTranslator.fmw
- Service: Data Streaming
- Requires Authentication: Disabled
- User Can Upload: Enabled
Optionally, customize the app after reviewing the Parameters. Once ready, click OK to save the app.
After clicking OK, you will be redirected to a new page that contains the URL for FME Flow App. This URL is how the app is accessed.
2. Test the EasyTranslator App
Click on the URL to open the app. Once the app has loaded, upload any dataset to the Source File parameter. If you need sample data, download Vancouver.sqlite from the Files section of this article then upload to the Source File parameter. Next, change the other parameters if desired and select an Output Format. Once ready, click Run.
The EasyTranslator.fmw workspace will run with the input dataset, and the output dataset will be available for download.
Data Validation
Live Demo
In this example, we will create an FME Flow App that validates data and displays the results of the validation back to the user.
How it Works
When an AutoCAD DWG file containing water main data is added to the workspace, the workspace will check for the following criteria:
- If the AutoCAD geometry is a line
- If it passes the OGC test using a GeometryValidator transformer
- If it passes the OGC test, then the workspace tests to ensure the pipe diameter is larger than 0. If the diameter is smaller than 0, it gets labeled with the “Invalid Attribute: Diameter” error.
- If it fails the OGC test, then the workspace assigns the error label “Invalid Geometry.”
- The workspace creates an HTML report that presents the errors to the user as well as a map showing the exact location of the error. For more on how to use FME for data validation and QA, see Tutorial: Data Validation and QA with FME.
Step-by-step Instructions
1. Download Starting Workspace and Publish to FME Flow
Download the DataValidation.fmw workspace from the Files section of this article. Once the workspace has been downloaded, either publish it to FME Flow using FME Workbench or upload the workspace directly in FME Flow using the following parameters:
- Repository: FMEFlowApps
- Workspace: DataValidation.fmw
- Services: Data Streaming, Job Submitter, Data Download
2. Create an FME Flow Workspace App
Create an FME Flow Workspace App following the instructions in the Creating an FME Flow Workspace App section using the following parameters:
- App Name: DataValidation
- Description: <See note below*>
- Repository: FMEFlowApp
- Workspace: DataValidation.fmw
- Service: Data Streaming
- Requires Authentication: Disabled
- User Can Upload: Enabled
*Note: To access sample data in the app for testing purposes, enter the following for Description:
Run this workspace to ensure that the watermain data is line data, with a pipe diameter larger than 0, and passes the OGC Valid test. Sample Files to Use Download [bad_data.dwg](https://demos.fmeserver.com/demo-validation-direct/download/bad_data.dwg) Download [good_data.dwg](https://demos.fmeserver.com/demo-validation-direct/download/good_data.dwg)
Optionally, customize the app after reviewing the Parameters. Once ready, click OK to save the app.
After clicking OK, you will be redirected to a new page that contains the URL for FME Flow App. This URL is how the app is accessed.
3. Test the DataValidation App
Click on the URL to open the app. Once the app has loaded, click on the bad_data.dwg link to download the test dataset. If you do not see this link, please edit the app and repeat Step 2 of this exercise, the bad_data.dwg is added to the Description.
After the data has been downloaded, upload the bad_data.dwg to the Source Autodesk AutoCAD DWG/DWF File(s) parameter. Once the data has been uploaded, click OK.
The DataValidation.fmw workspace will run with the input dataset, and an HTML data validation report will be streamed back.
Data Distribution
Live Demo
In this example, we will create an FME Flow Workspace App that provides an interface for a user to download a custom selection of data. The user can choose which layers they want to download, the extents by drawing a polygon on a map, as well as the format and coordinate system of the output data.
How it Works
The app runs the DataDistribution.fmw workspace which does the following:
- The workspace first gets the geometry of the area drawn by the user in GeoJSON using a GeometryReplacer, then reprojects it to the feature coordinate system using a Reprojector
- A FeatureReader reads in the feature layers selected by the user that intersect with the area drawn by the user.
- The feature layers are then clipped to the area drawn by the user using a Clipper.
- Finally, the layers are written out to the specified format and coordinate system using a generic writer, and then streamed back to the user.
Step-by-step Instructions
1. Download Source Data and Workspace
From the Files section of this article, download the DataDistribution zip file. Unzip the folder to a location on your computer. Within the folder is Transit.gdb Geodatabase and DataDistribution.fmw workspace.
2. Upload Source Data
Open and log into FME Flow. Click on Resources, then open the Data folder. In the Data folder, click Upload > Folder and navigate to the transit.gdb.
The full path of the dataset should be Data/transit.gdb. If you uploaded the geodatabase to a different folder, you will need to modify the workspace in the next step.
3. Publish the Workspace
Next, publish the DataDownload.fmw workspace to FME Flow using FME Workbench or upload the workspace directly in FME Flow using the following parameters:
- Repository: FMEFlowApp
- Workspace: DataDistribution.fmw
- Services: Data Streaming, Job Submitter, Data Download
If you uploaded transit.gdb to a different folder instead of Data/transit.gdb, you will need to open the workspace in FME Workbench and modify the FeatureReader. In the FeatureReader change the Dataset path to the path where you uploaded the dataset.
4. Create an FME Flow Workspace App
Create an FME Flow App following the instructions in the Creating an FME Flow Workspace App using the following parameters:
- App Name: DataDistribution
- Repository: FMEFlowApp
- Workspace: DataDistribution.fmw
- Service: Data Streaming
- Requires Authentication: Disabled
Optionally, customize the app after reviewing the Parameters. Once ready, click OK to save the app.
After clicking OK, you will be redirected to a new page that contains the URL for FME Flow App. This URL is how the app is accessed.
5. Test the DataDistribution App
Click on the URL to open the app. Once the app has loaded, select one or two Layers to Download from the drop-down. Next, click on the Map icon next to Area of Interest; this will launch the Geometry Parameter map.
In the Area of Interest dialog, click on the polygon icon, then click on the map to select an area. To close the polygon, click on the starting point. For more information on the Geometry Parameter, see the Using the Geometry Parameter in FME Flow article.
Once an area has been selected click OK to close the dialog. Optionally, change the Coordinate System and the Output Format if you'd like, then click OK.
The DataDistribution.fmw workspace will run using the Area of Interest to clip the data. Then if the output format can be streamed in a web browser, the output will appear. If the format cannot be displayed in a web browser, it will be downloaded.
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.