We’ve looked at various means in which to display aviation METAR or TAF (Terminal Area Forecast) data on your WordPress website in the past. However, the hurdles required to overcome the mild complexity involved with editing various files and messing with code often prohibits a lot of people from using the functionality we describe – or so we’re told. The solution: Another WordPress plugin.
METAR does what the functions we’ve formerly provided will do — display raw aviation data. The difference is that we now provide the options of including specific elements of a report rather than the whole thing. While we’ve launched it with just temperature and QNH (altimeter), we’ll be deploying additional versions in the near future that’ll make all sorts of interesting weather related data available, including all the other elements of a METAR or TAF report.
Note that we’re caching the examples on this page for up to a few hours to avoid making unnecessary requests to NOAA’s source website. The reports are not accurate.
The Metar and TAF
As we’ve seen before, once installed, the following line of code will render a current Sydney METAR report into your WordPress website.
TTF SPECI YSSY 241830Z 19020KT 9999 -DZ FEW006 BKN014 BKN020 19/19 Q1018 RMK RF00.0/001.2 FM1915 18015KT 9999 -SHRA SCT010 BKN020 TEMPO 1830/2130 4000 SHRA BKN010
To show a TAF report for JFK (New York), we’ll use
[taf loc="kjfk"]. The result:
TAF AMD KJFK 241759Z 2418/2524 17014G20KT P6SM FEW010 TEMPO 2423/2501 6SM BR BKN004 FM250100 17012KT 4SM BR BKN004 FM250400 16007KT 3/4SM BR OVC003 FM251600 15012KT 3SM BR OVC005 FM252300 17013KT 6SM -SHRA BR BKN006 PROB30 2523/2524 5SM -TSRA BKN006CB
The only two available shortcode attributes for a Metar report are
cache. The cache is set to keep METAR results for an hour by default (
cache="3600"). To increase this to two hours (7200 seconds), for example, use
[taf loc="kjfk" cache="7200"] or to retrieve a new result every 15 minutes, use
[taf loc="kjfk" cache="900"].
The location must be a valid 4-digit ICAO code (not the IATA code). For example, Sydney is
SYD. You can find a list of all available Metar stations here.
Pressure – QNH or Inches of Mercury
To extract the aerodrome pressure from the report, the shortcode of
[qnh loc="yssy"] should be used (where
yssy is your location of choice). By default, we’ll always return the QNH – not inches of mercury.
The shortcode of
[qnh loc="yssy"] will output a QNH of 1018.
A USA METAR report will normally prefix their pressure with an A, for altimeter, while it’s Q in most other parts of the world. Since QNH is the ICAO standard, it defaults to true, regardless of what pressure the report provides.
- QNH JFK is 1025
- Altimeter JFK is 30.28
[qnh loc="kjfk" unit="0"]
The shortcode provides the value only. Bolding is mine to highlight the result.
The temperature (and dew point temperature) on a Metar report is almost always reported in Celsius. The following temperature results are based on data from KJFK. Again, the option to cache your report for longer or shorter than the default hour applies. To cache your report for two hours, use
[temperature loc="kjfk" temp="1" cache="7200"], or to cache it for just 30 minutes, use
[temperature loc="kjfk" temp="1" cache="1800"].
The bold text in the below results is my own to illustrate the differences between the returned temperatures.
- Temperature (normalised integer °C) is 17
[temperature loc="kjfk" temp="1"]
- Dew Point Temp (normalised integer °C) is 11
[temperature loc="kjfk" temp="2"]
- Raw Temp (from Metar °C) is 17
[temperature loc="kjfk" temp="3"]
- Raw Dew Point Temp (from Metar °C) is 11
[temperature loc="kjfk" temp="4"]
- Temperature (°F) (normalised integer) is 63
[temperature loc="kjfk" temp="5"]
- Dew Point Temp (°F) (normalised integer) is 52
[temperature loc="kjfk" temp="6"]
- Raw report data is 17/11
[temperature loc="kjfk" temp="7"]
In the examples above, the ‘raw’ temperature will return whatever is provided in the report. Negative temperatures will be prefixed with an ‘M’ and single digit temperatures will include a leading ‘0’.
To install Metar, you have a few options.
- Download from the WordPress repository and FTP into your plugin directory, then activate via your control panel.
- Download from the WordPress repository and upload the zip file into WordPress via the administration panel.
- Easiest and fastest: Search for “Metar” from within your WordPress plugin dashboard. “Install” then “Activate”. Make sure you download our version, by BeliefMedia .
If you have problems, leave a comment below.
Showing Metar Reports in Widgets
There’s are a couple of plugins that don’t do anything other than provide a widget for various reports. We’ve avoided this in the first instance because shortcodes give you more freedom in how you format data and seriously flexibility in where you place it.
Since WordPress doesn’t enable shortcodes in Widget areas by default, we’ve provided an option to enable the functionality. Navigate your way to
Metar Shortcode (once the plugin is activated) and you’ll see the following option.
If your shortcodes are showing up in Widgets as plain text, and only if they’re showing as text (and not rendering a result), select the option to ‘Yes’ and click
Update » .
You then only have to drag a normal text widget into a sidebar, or another location that supports them, and include your shortcode.
How do I Add the °C or °F part?
We didn’t want to provide °C or °F extension because it limits the way in which you can present data. For example, the temperature in Sydney is currently 19°C (66°F) … but I could also just write that it’s currently 19 degrees.
I created the degrees symbol with the string of
Features Coming Soon
As with a lot of the plugins we’ll be adding over the next few months, most of them are just to establish a means of eliciting feedback from the people that are most likely to use them. That said, the following features will likely be added in the next release.
- While widgets are limiting, we’ll likely add them for those few that’ll use them.
- Add other elements of both METAR and TAF reports: wind, weather, cloud etc.
- Add (US) PIREPs as reported by AviationWeather.gov .
- Add reports not provided by NOAA. Bankstown (YSBK), in Australia, for example.
- Include traditional weather forecasts.
Download, Support & Suggestions
Download the plugin below or, as suggested, install it directly from within WordPress.
If you have any specific feature requests or suggestions, please let us know.
Version 0.2 – 18th December, 2015
Changes and considerations in Version 0.2 are as follows:
- We’ve rewritten chunks of code to prepare for widgets, and to make obtaining reports more efficient.
- Any Australian report is now obtained from the Bureau of Meteorology website. This means you can obtain a report for any Australian METAR/TAF, or ARFOR.
- ARFORs should be obtained with the shortcode of [sc]arfor loc=”21″[/sc] where
21is the area you wish to query.
- For Australian reports only, you can render a TAF or METAR with the line breaks included (as intended) by using
tidy="0". We wrap everything into one string by default.
- We’ve added the option to remove paragraph tags (as is the case with the naked shortcode function). To render reports inline use
- All existing reports in your website will be unchanged.
- To include a degrees symbol (°) alongside temperatures, use
degrees="1"in your temperature shortcode.
- Consideration needs to be made to any copyright that the BOM might apply. Any Australian report needs to be accompanied with a operational disclaimer citing the source.
The next release should be far more comprehensive.
Shortt URL for this post: