Weather Updates and FME Server (Tutorial)

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2017.x

As of FME Server 2019+, this functionality can be completed using FME Server Automations. For more information, please see Send Email from Automations and Building Integrations with the FME Server Automation Writer. Note that this tutorial series will no longer be updated, if you encounter an error, please contact Safe Support

Introduction

FME Workbench can be used to build a workspace that will check datasets or services for the desired outcome, changed values or values that meet certain criteria. These can then be run regularly on FME Server, on a schedule.

If data is returned, change identified or criteria met the workspace can trigger events (subscriptions). This could be data processing or sending a notification.

In this tutorial we will be using the OpenWeatherMapForcaster to check the weather and send a notification to FME Server about the current conditions.

 

Step-by-step Instructions

Please download the OpenWeatherMapForecaster transformer from the FME Hub. You will need to sign up for an api key from OpenWeatherMap.

This transformer takes point geometry to return the weather forecast, so you will need to create a point of interest (where you want weather forecasts) in FME.

Some useful coordinates may be:

Convention Centre (FME UC location): lat: 49.2892260, lon: -123.1169553

Safe Software office: lat: 49.138036 lon: -122.857629

You can also find your own lat/lon coordinates using Google Maps.

 

Enter the coordinates into the Creator by putting the lon value in the ‘X Value’ and the lat value into the ‘Y Value’. To do this you will need to click on the [...] next to the ‘Geometry Object: Point’.

Run the workspace and inspect the output.

creator-point.png

In the OpenWeatherMapForecaster, set the Weather to ‘Current’ and enter the API Key.

Now we want to create a notification message. Add an AttributeCreator and construct your message using the outputs from the OpenWeatherMapForecaster.

For example:

New Attribute: Weather Message

Attribute Value: Right now the weather is a @Value(weather_description). Cloud cover is @Value(clouds)%.

weather-message.png

We need somewhere to send this message, so we will send it to a topic on FME Server. Open the Web UI for FME Server, and go to Notifications > Topics. Add a new topic, called Weather_Alert. You should also see the option for Topic Monitoring. Select the Weather_Alert topic and press the play button to start monitoring. DO NOT close this tab, we will want to check back here after running our weather workspace.

 

Back in workbench, add an FMEServerNotifier and open the parameters. Add a connection to FME Server, select the Weather_Alert topic, and for the content choose your weather message attribute.

weather-workspace-complete.png

Run the workspace. Once complete, check back on your notifications page open in your browser. You should see your message appear under the topic monitoring.

 

As a stretch, can you adapt the workspace to check the future weather forecast and notify based on different weather events?
Hint: Check out WeatherUpdates-Complete.fmw

 

Results:

You should see the message that you constructed in the AttributeCreator appear as a topic message in FME Server, when monitoring the Weather_Alert topic.

You could create a subscription that is triggered by this topic that can alert someone about upcoming weather conditions, such as sending an email or SMS.

 

 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.