FME Version
Files
Introduction
Streaming data via a URL is a great way to share data with someone who does not have FME installed or you are sharing a dataset that is local on your computer or coming from a live feed. You could also embed the direct URL into another project, such as a web map. For an example on how to create an FME Server App that utilizes data streaming, please see the Data Distribution - FME Server App article.
In this example, we are reviewing the demo workspace that comes with FME Server in the Samples repository.
Example
Run the Example
Let’s start off by running the example so we know what we are working with. The following URL is the earthquakeextrusion.fmw workspace that comes with FME Server running on our demo FME Cloud instance. When you click on the link, the workspace will run in FME Cloud, then return the quakes.kml dataset which will begin downloading. You do not need FME Server installed to use this link:
https://demos-safe-software.fmecloud.com/fmedatastreaming/Samples/earthquakesextrusion.fmw
If you open quakes.kml in Google Earth, you will see all of the earthquakes around the world with an extrusion based on earthquake magnitude.
The Workspace
Now that we know how the URL works, let’s review what the workspace is doing. You can either download the workspace from the Files section of this article or if you have FME Server installed, you can download the earthquakesextrusion.fmw from the Samples repository.
The workspace is fairly straightforward, it is reading in a GeoJSON feed from USGS, then based on the magnitude listed in the JSON, it is raising it to the power of 10 to really exaggerate the data.
Next, the workspace utilizes the KMLDiagrammer custom transformer, which is available to download from FME Hub. This transformer creates features that appear in 3D when opened in Google Earth.
Once the earthquake extrusions have been created, they are then sorted by magnitude and colored red. Finally, the data is written out to OGC/Google KML.
Set Up Data Streaming in FME Server
Setting up data streaming begins in FME Workbench when the data is uploaded to FME Server. When using the FME Server Publishing Wizard, on the final page where you Register Services, be sure to enable Data Streaming. If you have more than one writer, click on Edit to confirm which writers you would like to use for the output.
Once the data has been published to FME Server, navigate and log into FME Server to continue setting up the data stream.
In FME Server, navigate to the Run Workspace page, then select Samples as the Repository, earthquakesextrusion.fmw as the Workspace, then set the Service to Data Streaming.
If you were to click Run, the workspace would run and quakes.kml would be downloaded to your computer. Instead, let’s build our URL to share with other users.
Ensure that the Guest role is enabled on your FME Server, then change the following URL to your FME Server hostname:
<hostname or FME Cloud URL>/fmedatastreaming/Samples/earthquakesextrusion.fmw
Data Attribution
The data used here originates from data made available by the USGS - United States Department of the Interior. It contains information available to the public domain.
Comments
0 comments
Please sign in to leave a comment.