Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Using the Metar Graphing API

Using the Metar Graphing API

We've collected METAR reports for various stations for the better part of 20 years. In fact, we've recorded and archived Bureau of Meteorology data, ATIS reports, satellite imagery, and other information for the purpose of various type of modeling, and to provide back-end support to some of our aviation websites and/or clients, for as long as we've been around (quite frankly, we're data-hoarders). To support this meteorological data we have a bunch of different graphing tools, but the one we make available to clients for rendering METAR data (at this stage) is a super-simple image graph. This article introduces its use.

The Basic Result

Requesting temperature, pressure, and dew point data (the latter two as line-graphs) for a 100-day period back in 2018 (?er=s&s=yssy&ed=20180207&n=100) returns the following:

Using the Metar Graphing API

You will note that we're using a stock market-style candlestick graph; this enables us to return the temperature range for a particular day (low and high) but also the 'opening' and 'closing' temperature for each day (red indicating that the temperature finished lower than it started, otherwise green) - this enables trends to be identified very quickly.

Metar Elementor Block

If you're using Elementor, the easiest way of including the graphs into your pages is simply by dragging and dropping the block into your page and then selecting the appropriate station and graph to render. If a fixed graph you select the 'Permanent' option to import the graph into your own WordPress library, or you may optionally create them on our server and simply reference them to show real-time data (you don't want hundreds of Metar graphs in your own library).

WordPress Shortcode

The graph shown above may be returned directly into WordPress via the use of the following shortcode: [metargraph s="yssy" ed="20180207" n="100"]. By default we'll import the image into your WordPress library and reference that image (the expectation is that you'll be using the graph as an example, or referencing a specific range of dates). To show the image directly to screen - rather than referencing an image on our server - use library="0" in your shortcode.

API Parameters

If you're using the API for used in your own application the endpoint for all requests: https://api.beliefmedia.com/metargraph/.

s (s=yssy)

ICAO Station code, such as 'yssy'. Return all station codes in JSON format with the value of lj. Field is required. Any station we currently archive is available.

apikey (apikey=xxx)

API Key. Required. The JSON reponse include the image URL whcih should be used to reference the image. Your API Key must not be shown publicly.

f (f=w)

Data frequency. Valid values are: d = Daily, w = Weekly, m = Monthly.

n (n=14)

Number of data plots. Defaults to 28.

tg (tg=l)

Temperature graph type. c = Temperature candlestick graph, l = Temperature line graph.

dp (dp=n)

Show dew point. Valid values are: y = Yes, n = No.

p (p=n)

Show pressure. Valid values are: y = Yes, n = No.

im (im=n)

Return image of requested graph. Valid values are: y = Yes, n = No (image saved to server).

sd (sd=20201105)

Start Date. Optional. When not specified, the n parameter used to determine start date. Use a standard 6 figure or longer time group (sd=20201105, sd=20201105235959).

ed (ed=20201105)

End Date. Optional. Defaults to NOW if start date not specified otherwise the n parameter used to determine end date (ed=20201105, ed=20201105235959).

er (er=s)

Error messages array. Valid values are: j = Return errors array in JSON format.

Conclusion

We have a JavaScript API that is meant to emulate Google's image library in many respects with the exception that we believe ours is more intuitive (the Google graphs were so problematic in WordPress that we removed old examples). Image graphs also have the advantage in that they can be easily migrated into Word Documents and other applications without the complexity associated with messy JS code, or without having to take screenshots.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Virginia)

  Want to have a chat?
 

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment