Live Open Weather Map Agent

<< Click to Display Table of Contents >>

Navigation:  Live > Agents > Web API Agents > Web API Open Data >

Live Open Weather Map Agent

Report Name: EQuIS Live: Open Weather Map Agent (example)

File Name: EarthSoft.Live.Reports.dll

 

Description: The EQuIS Live: Open Weather Map Agent report allow users to retrieve current and forecast weather data from Open Weather Map web API in EQuIS Professional and Enterprise. Open Weather Map allows users to request current weather data, up to 60 calls per minute for free; it provides weather data for over 200,000 cities.

 

Tables: DT_LOGGER, DT_LOGGER_SERIES, DT_LOGGER_DATUM

 

 

Adding Location(s)

 

Before running this report, one or more locations must be added to the DT_LOGGER table:

1.Sign up and obtain an Open Weather Map API key.

2.Add the location (DT_LOGGER rows) in EQuIS Professional.

3.Set LIVE_DATA_SOURCE to a Uniform Resource Identifier (URI) that can be used to request the weather data:
 
e.g. https://api.openweathermap.org/data/2.5/weather?id=6182962&appid=7883671a09db2ae69d6c380ba&units=metric where 6182962 is the location's ID and 7883671a09db2ae69d6c380ba is the API key.
 
Users can search for a location by name and get its ID from the search result link's URI. (For example, searching for London, UK, returns https://openweathermap.org/city/2643743, and 2643743 is the location ID.)
 
Or search for a location using the map. This will not give the location ID but will give the name, which can then be searched for.

 

Notes:

Open Weather Map's current weather data and 5 day weather forecast pages contain additional URI examples (you can also request a location's weather data using a city name, latitude and longitude, or ZIP code, in addition to a location ID).

If units are unspecified in the URI (metric or imperial), the default units (e.g., temperatures in Kelvin) will be returned.

The Open Weather Map Agent only allows one location per logger, and only supports JavaScript Object Notation (JSON), not XML.

 

 

4.Set LOGGER_CODE to anything (e.g., the location name or ID); it is not used, but cannot be NULL.

5.(Optional) If you would like to encrypt the API key, please contact EarthSoft Support. Once the encrypted key is received back from EarthSoft, set CUSTOM_FIELD_1 to your encrypted API key and LIVE_DATA_SOURCE to something resembling the example below:
 
e.g. https://api.openweathermap.org/data/2.5/weather?id=6182962&appid=${api_key}&units=metric
where 6182962 is the location's ID and ${api_key} represents the encrypted API key (in CUSTOM_FIELD_1).  
 

6.Set STATUS_FLAG to 'A' to activate the logger.

 

 

Loading Data

 

This report will automatically add the series (and datum) when it runs. However, some of the locations may not have one or more of the series listed below, in which case those series will not be added.

 

SERIES_NAME

SERIES_DESC

STATUS_FLAG *

main.grnd_level

Atmospheric pressure on the ground level, hPa

R

main.humidity

Humidity, %

A

main.pressure

Atmospheric pressure (on the sea level, if there is no SEA_LEVEL or GRND_LEVEL data), hPa

A

main.sea_level

Atmospheric pressure on the sea level, hPa

R

main.temp

Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.

A

main.temp_max

Maximum temperature at the moment. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded.

R

main.temp_min

Minimum temperature at the moment. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded.

R

rain.1h

Rain volume for last 1 hour, mm

A

rain.3h

Rain volume for last 3 hours, mm

A

snow.1h

Snow volume for last 1 hour, mm

A

snow.3h

Snow volume for last 3 hours, mm

A

wind.deg

Wind direction, degrees (meteorological)

A

wind.speed

Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.

A

 

* The STATUS_FLAG column value is the initial status flag when the series is added. A series can then be activated or deactivated by setting its STATUS_FLAG = 'A' or 'R', to start or stop (respectively) obtaining data for it. Note: A STATUS_FLAG of 'R' is initially assigned to some of the series. Also, the SERIES_UNIT and SERIES_DESC for a series may be changed, but not its SERIES_NAME; it uniquely identifies the series.

 

This report can be run manually or as scheduled EQuIS Information Agent (EIA), at the desired frequency, to automatically load data as often as needed. It will load data for all loggers with LIVE_DATA_SOURCE containing api.openweathermap.org.