Skip to content
Arnaud Varin edited this page Aug 31, 2023 · 10 revisions

This Mod for Spotfire® can be used to provide live weather information and 7 days forecasts. In addition to instant weather information for a location, this visualization also provides toggleable temperature (°C or °F) in local time and current weather conditions like wind, humidity, visibility and weather description.

Installation

Opening the visualization in Spotfire® Analyst

  1. From this repository Releases section, locate and download the .mod file.
  2. Drag the .mod file into an analysis in Spotfire® Analyst.

For information on how to use and share visualizations mods, read the Spotfire® documentation.

Running the project in Spotfire®

  1. From this repository Releases section, locate and download the source code.
  2. Build the project in your preferred code editor. Microsoft Visual Studio Code is highly recommended.
  3. Open an analysis in Spotfire® and select Tools > Development > Create visualization mod from the menubar to connect to the project.

For information on how to get started with visualization mod development, read the Spotfire® documentation.

Data Requirement

Every mod handles missing, corrupted and/or inconsistent data in different ways. It is advised to always review how the data is visualized.

To make this visualization work properly, the underlying data must be formatted in a certain way. It requires City ID, longitude, latitude as specified in the OpenWeatherMap city data.

Setup

In this example dataset, we have six columns: city ID, city name, state, country, longitude and latitude.

id city state country longitude latitude
1261481 New Delhi IN 77.23 28.61
1850147 Tokyo JP 139.69 35.69
2172517 Canberra AU 149.13 -35.28
2643743 London GB -0.13 51.51
2673730 Stockholm SE 18.06 59.33
4140963 Washington, D.C DC US -77.04 38.90

Weather mod can be configured to show the current weather conditions for a location with the following settings:

  • City ID= id
  • Color By = city

Configuration

Getting an API Key

An OpenWeatherMap API Key is required in order to query weather information from the service. Create a new OpenWeatherMap account and select the appropriate plan as per your requirement. More information can be found on how to start to work with OpenWeatherMap API.

Setting the API Key

Once you have obtained the API Key, add it as a document property on Spotfire.

City ID

For optimized performance, it is recommended to limit data using expression to the required city IDs. This is done from the visualization properties, in the Data section.

Color By

This visualization automatically picks up the color values set in the Cole By axis. For best results, set the Color mode to Fixes. This is done from the visualization properties, in the Colors section.

Usage

Toggling temperature units

Temperature values can be switched from celsius to fahrenheit and vice versa by clicking on the °C or °F icons on the weather mod.